mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +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>
137 lines
3.3 KiB
Plaintext
137 lines
3.3 KiB
Plaintext
---
|
|
id: auth-resetpasswordforemail
|
|
title: 'resetPasswordForEmail()'
|
|
slug: /auth-resetpasswordforemail
|
|
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'
|
|
|
|
Sends a password reset request to an email address.
|
|
|
|
```js
|
|
const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {
|
|
redirectTo: 'https://example.com/update-password',
|
|
})
|
|
```
|
|
|
|
## Parameters
|
|
|
|
<ul className="method-list-group">
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
email
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The email address of the user.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
options
|
|
</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>
|
|
|
|
<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">
|
|
captchaToken
|
|
</span>
|
|
<span className="method-list-item-label-badge false">
|
|
optional
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
Verification token received when the user completes the captcha on the site.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
redirectTo
|
|
</span>
|
|
<span className="method-list-item-label-badge false">
|
|
optional
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The URL to send the user to after they click the password reset link.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
## Notes
|
|
|
|
Sends a password reset request to an email address.
|
|
|
|
When the user clicks the password reset link in the email, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings).
|
|
|
|
`<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery`
|
|
|
|
Your app must detect `type=recovery` in the fragment and display a password reset form to the user.
|
|
|
|
You should then [update the user](/docs/reference/javascript/next/auth-updateuser) as follows:
|
|
|
|
```js
|
|
const { error, data } = await supabase.auth.updateUser({
|
|
password: new_password,
|
|
})
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Reset password
|
|
|
|
```js
|
|
const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {
|
|
redirectTo: 'https://example.com/update-password',
|
|
})
|
|
```
|