mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 02:45:07 +03:00
* docs: cleanup auth docs * docs: update auth docs * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml Co-authored-by: dng <danny@supabase.io> * Update spec/supabase_js_v2_legacy.yml * update auth docs * add supabase auth admin api overview page * resolve PR comments * resolve PR comments * update auth docs with latest tsdocs Co-authored-by: dng <danny@supabase.io>
118 lines
2.6 KiB
Plaintext
118 lines
2.6 KiB
Plaintext
---
|
|
id: auth-verifyotp
|
|
title: 'verifyOtp()'
|
|
slug: /auth-verifyotp
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs'
|
|
import TabItem from '@theme/TabItem'
|
|
|
|
Log in a user given a User supplied OTP received via mobile.
|
|
|
|
```js
|
|
const { data, error } = await supabase.auth.verifyOtp({
|
|
phone,
|
|
token,
|
|
type: 'sms',
|
|
})
|
|
```
|
|
|
|
## Parameters
|
|
|
|
<ul className="method-list-group">
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
VerifyOtpParams
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>VerifyMobileOtpParams</code> | <code>VerifyEmailOtpParams</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
<ul className="method-list-group">
|
|
<h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
VerifyMobileOtpParams
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>object</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
VerifyEmailOtpParams
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>object</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
## 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)
|
|
|
|
```js
|
|
const { data, error } = await supabase.auth.verifyOtp({
|
|
phone,
|
|
token,
|
|
type: 'sms',
|
|
})
|
|
```
|
|
|
|
### Verify Signup One-Time Password (OTP)
|
|
|
|
```js
|
|
const { data, error } = await supabase.auth.verifyOtp({
|
|
email,
|
|
token,
|
|
type: 'signup',
|
|
})
|
|
```
|