verifyOtp()

Log in a user given a User supplied OTP received via mobile.

1const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})

Parameters#

  • VerifyOtpParamsrequired
    VerifyMobileOtpParams
    |
    VerifyEmailOtpParams

    No description provided.

      Properties
    • VerifyMobileOtpParamsrequired
      object

      No description provided.

    • VerifyEmailOtpParamsrequired
      object

      No description provided.

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)#

1const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})

Verify Signup One-Time Password (OTP)#

1const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'signup'})