Generates email links and OTPs to be sent via a custom email provider.
generateLink()
: signup
, magiclink
, invite
, recovery
, email_change_current
, email_change_new
, phone_change
.generateLink()
only generates the email link for email_change_email
if the Secure email change is enabled in your project's email auth provider settings.generateLink()
handles the creation of the user for signup
, invite
and magiclink
.undefined
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'signup',
email: 'email@example.com',
password: 'secret'
\})
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'invite',
email: 'email@example.com'
\})
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'magiclink',
email: 'email@example.com'
\})
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'recovery',
email: 'email@example.com'
\})
// generate an email change link to be sent to the current email address
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'email_change_current',
email: 'current.email@example.com',
newEmail: 'new.email@example.com'
\})
// generate an email change link to be sent to the new email address
const \{ data, error \} = await supabase.auth.admin.generateLink(\{
type: 'email_change_new',
email: 'current.email@example.com',
newEmail: 'new.email@example.com'
\})