Skip to content

Commit a8b254f

Browse files
docs: enhance verifyOtp() and resend() method description with detailed verification types (supabase#37339)
* docs: enhance verifyOtp() method description with detailed verification types and examples * Update apps/docs/spec/supabase_js_v2.yml --------- Co-authored-by: Charis <[email protected]>
1 parent ecc0388 commit a8b254f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

apps/docs/spec/supabase_js_v2.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,15 @@ functions:
10951095
title: 'verifyOtp()'
10961096
$ref: '@supabase/auth-js.GoTrueClient.verifyOtp'
10971097
notes: |
1098-
- 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: `email`, `recovery`, `invite` or `email_change` (`signup` and `magiclink` types are deprecated).
1098+
- The `verifyOtp` method takes in different verification types.
1099+
- If a phone number is used, the type can either be:
1100+
1. `sms` – Used when verifying a one-time password (OTP) sent via SMS during sign-up or sign-in.
1101+
2. `phone_change` – Used when verifying an OTP sent to a new phone number during a phone number update process.
1102+
- If an email address is used, the type can be one of the following (note: `signup` and `magiclink` types are deprecated):
1103+
1. `email` – Used when verifying an OTP sent to the user's email during sign-up or sign-in.
1104+
2. `recovery` – Used when verifying an OTP sent for account recovery, typically after a password reset request.
1105+
3. `invite` – Used when verifying an OTP sent as part of an invitation to join a project or organization.
1106+
4. `email_change` – Used when verifying an OTP sent to a new email address during an email update process.
10991107
- The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user.
11001108
- The `TokenHash` is contained in the [email templates](/docs/guides/auth/auth-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](/docs/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr) for more details.
11011109
examples:
@@ -1653,7 +1661,7 @@ functions:
16531661
- Resends a signup confirmation, email change or phone change email to the user.
16541662
- Passwordless sign-ins can be resent by calling the `signInWithOtp()` method again.
16551663
- Password recovery emails can be resent by calling the `resetPasswordForEmail()` method again.
1656-
- This method will only resend an email or phone OTP to the user if there was an initial signup, email change or phone change request being made.
1664+
- This method will only resend an email or phone OTP to the user if there was an initial signup, email change or phone change request being made(note: For existing users signing in with OTP, you should use `signInWithOtp()` again to resend the OTP).
16571665
- You can specify a redirect url when you resend an email link using the `emailRedirectTo` option.
16581666
examples:
16591667
- id: resend-email-signup-confirmation

0 commit comments

Comments
 (0)