Dart Reference v2.0

Sign in a user through OTP

  • Requires either an email or phone number.
  • This method is used for passwordless sign-ins where an OTP is sent to the user's email or phone number.
  • If you're using an email, you can configure whether you want the user to receive a magiclink or an OTP.
  • If you're using phone, you can configure whether you want the user to receive an OTP.
  • The magic link's destination URL is determined by the SITE_URL. You can modify the SITE_URL or add additional redirect urls in your project.
Parameters
    email
    Optional
    String

    Email address to send the magic link or OTP to.

    phone
    Optional
    String

    Phone number to send the OTP to.

    emailRedirectTo
    Optional
    String

    The URL to redirect the user to after they click on the magic link.

    shouldCreateUser
    Optional
    bool

    If set to false, this method will not create a new user. Defaults to true.

    data
    Optional
    Map<String, dynamic>

    The user's metadata to be stored in the user's object.

    captchaToken
    Optional
    String

    The captcha token to be used for captcha verification.

    channel
    Optional
    OtpChannel

    Messaging channel to use (e.g. whatsapp or sms). Defaults to OtpChannel.sms.


await supabase.auth.signInWithOtp(
  email: '[email protected]',
  emailRedirectTo: kIsWeb ? null : 'io.supabase.flutter://signin-callback/',
);