signInWithOtp()

1await supabase.auth.signInWithOtp(
2  email: 'example@email.com',
3  emailRedirectTo: kIsWeb ? null : 'io.supabase.flutter://signin-callback/',
4);

Notes#

  • Requires either an email or phone number.
  • This method is used for passwordless sign-ins where a 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 a OTP.
  • If you're using phone, you can configure whether you want the user to receive a 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.

Examples#

Sign in with email.#

The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds. You can pass emailRedirectTo with dynamic link to bring the users back to your app after they click on the magic link.

1await supabase.auth.signInWithOtp(
2  email: 'example@email.com',
3  emailRedirectTo: kIsWeb ? null : 'io.supabase.flutter://signin-callback/',
4);

Sign in with SMS OTP.#

The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds.

1await supabase.auth.signInWithOtp(
2  phone: '+13334445555',
3);