Files
supabase/apps/reference/_supabase_js/generated/auth-verifyotp.mdx
T
Kang Minganddng 2812617d0f docs: update auth docs for supabase-js v2 (#8648)
* 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>
2022-08-30 13:40:08 +08:00

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',
})
```