Log in a user given a User supplied OTP or TokenHash received through mobile or email.
verifyOtp
method takes in different verification types.sms
– Used when verifying a one-time password (OTP) sent via SMS during sign-up or sign-in.phone_change
– Used when verifying an OTP sent to a new phone number during a phone number update process.signup
and magiclink
types are deprecated):
email
– Used when verifying an OTP sent to the user's email during sign-up or sign-in.recovery
– Used when verifying an OTP sent for account recovery, typically after a password reset request.invite
– Used when verifying an OTP sent as part of an invitation to join a project or organization.email_change
– Used when verifying an OTP sent to a new email address during an email update process.verifyOtp
to sign up / sign-in a user.TokenHash
is contained in the email templates and can be used to sign in. You may wish to use the hash with Magic Links for the PKCE flow for Server Side Auth. See this guide for more details.const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'email'})
const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})
const { data, error } = await supabase.auth.verifyOtp({ token_hash: tokenHash, type: 'email'})