verifyOtp()

1final AuthResponse res = await supabase.auth.verifyOTP(
2  type: OtpType.sms,
3  token: '111111',
4  phone: '+13334445555',
5);
6final Session? session = res.session;
7final User? user = res.user;

Notes#

  • The verifyOtp method takes in different verification types. If a phone number is used, the type can either be sms or phone_change. If an email address is used, the type can be one of the following: signup, magiclink, recovery, invite or email_change.
  • The verification type used should be determined based on the corresponding auth method called before verifyOtp to sign up / sign-in a user.

Examples#

Verify Sms One-Time Password (OTP)#

1final AuthResponse res = await supabase.auth.verifyOTP(
2  type: OtpType.sms,
3  token: '111111',
4  phone: '+13334445555',
5);
6final Session? session = res.session;
7final User? user = res.user;

Verify Signup One-Time Password (OTP)#

1final AuthResponse res = await supabase.auth.verifyOTP(
2  type: OtpType.signup,
3  token: token,
4  phone: '+13334445555',
5);
6final Session? session = res.session;
7final User? user = res.user;