Generate an email link
Generates email links and OTPs to be sent via a custom email provider.
- The following types can be passed into
generateLink()
:signup
,magiclink
,invite
,recovery
,emailChangeCurrent
,emailChangeNew
,phoneChange
. generateLink()
only generates the email link foremail_change_email
if the "Secure email change" setting is enabled under the "Email" provider in your Supabase project.generateLink()
handles the creation of the user forsignup
,invite
andmagiclink
.
Parameters
type
REQUIRED
GenerateLinkTypeThe type of invite link to generate.
email
REQUIRED
StringEmail address of the user to invite.
password
Optional
StringPassword for the user. Required for signup
type.
redirectTo
Optional
StringURI to redirect the user to after they open the invite link.
data
Optional
Map<String, dynamic>A custom data object to store the user's metadata. This maps to the auth.users.user_metadata
column.
final res = await supabase.auth.admin.generateLink(
type: GenerateLinkType.signup,
email: '[email protected]',
password: 'secret',
);
final actionLink = res.properties.actionLink;