generateLink()

Generates email links and OTPs to be sent via a custom email provider.

1const { data, error } = await supabase.auth.admin.generateLink({
2  type: 'signup',
3  email: 'email@example.com',
4  options: {
5    'password': 'secret'
6  }
7})

Parameters#

  • GenerateLinkParamsrequired
    GenerateSignupLinkParams
    |
    GenerateInviteOrMagiclinkParams
    |
    GenerateRecoveryLinkParams
    |
    GenerateEmailChangeLinkParams

    No description provided.

      Properties
    • GenerateSignupLinkParamsrequired
      object

      No description provided.

    • GenerateRecoveryLinkParamsrequired
      object

      No description provided.

    • GenerateInviteOrMagiclinkParamsrequired
      object

      No description provided.

    • GenerateEmailChangeLinkParamsrequired
      object

      No description provided.

Examples#

1const { data, error } = await supabase.auth.admin.generateLink({
2  type: 'signup',
3  email: 'email@example.com',
4  options: {
5    'password': 'secret'
6  }
7})
1const { data, error } = await supabase.auth.admin.generateLink({
2  type: 'invite',
3  email: 'email@example.com'
4})
1const { data, error } = await supabase.auth.admin.generateLink({
2  type: 'magiclink',
3  email: 'email@example.com'
4})
1const { data, error } = await supabase.auth.admin.generateLink({
2  type: 'recovery',
3  email: 'email@example.com'
4})
1// generate an email change link to be sent to the current email address
2const { data, error } = await supabase.auth.admin.generateLink({
3  type: 'email_change_current',
4  email: 'current.email@example.com',
5  newEmail: 'new.email@example.com'
6})
7
8// generate an email change link to be sent to the new email address
9const { data, error } = await supabase.auth.admin.generateLink({
10  type: 'email_change_new',
11  email: 'current.email@example.com',
12  newEmail: 'new.email@example.com'
13})