mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
Merge pull request #487 from supabase/chore/password-docs
Chore/password docs
This commit is contained in:
20 files changed
+160
-52
No files matched your search
@@ -7,8 +7,44 @@ slug: auth-forgotpassword
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
groupId="libraries"
|
||||
values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
|
||||
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { data, error } = supabase.auth.api.resetPasswordForEmail('user@email.com')
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="py">
|
||||
|
||||
```py
|
||||
# Not yet implemented
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
Sends a reset request to an email address.
|
||||
|
||||
When the user clicks the reset link in the email they will be forwarded to:
|
||||
`<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 use the access_token in the url and new password to update the user as follows:
|
||||
|
||||
```js
|
||||
const { error, data } = await auth.api
|
||||
.updateUser(access_token, { password : new_password })
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
@@ -7,8 +7,44 @@ slug: reset-password-email
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
groupId="libraries"
|
||||
values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
|
||||
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { data, error } = supabase.auth.api.resetPasswordForEmail('user@email.com')
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="py">
|
||||
|
||||
```py
|
||||
# Not yet implemented
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
Sends a reset request to an email address.
|
||||
|
||||
When the user clicks the reset link in the email they will be forwarded to:
|
||||
`<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 use the access_token in the url and new password to update the user as follows:
|
||||
|
||||
```js
|
||||
const { error, data } = await auth.api
|
||||
.updateUser(access_token, { password : new_password })
|
||||
```
|
||||
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
groupId="libraries"
|
||||
|
||||
@@ -25,7 +25,7 @@ Gets the user details.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +65,7 @@ A valid, logged-in JWT.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.getUser(access_token)
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Sends an invite link to an email address.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +65,7 @@ The email address of the user.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.inviteUserByEmail('example@email.com')
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Generates a new JWT.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +65,7 @@ A valid refresh token that was returned on login.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.refreshAccessToken(refresh_token)
|
||||
```
|
||||
|
||||
|
||||
@@ -7,8 +7,44 @@ slug: api-resetpasswordforemail
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs
|
||||
defaultValue="js"
|
||||
groupId="libraries"
|
||||
values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>
|
||||
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { data, error } = supabase.auth.api.resetPasswordForEmail('user@email.com')
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="py">
|
||||
|
||||
```py
|
||||
# Not yet implemented
|
||||
```
|
||||
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
Sends a reset request to an email address.
|
||||
|
||||
When the user clicks the reset link in the email they will be forwarded to:
|
||||
`<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 use the access_token in the url and new password to update the user as follows:
|
||||
|
||||
```js
|
||||
const { error, data } = await auth.api
|
||||
.updateUser(access_token, { password : new_password })
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Parameters
|
||||
@@ -25,7 +61,7 @@ Sends a reset request to an email address.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +101,7 @@ The email address of the user.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.resetPasswordForEmail('example@email.com')
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Sends a magic login link to an email address.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +65,7 @@ The email address of the user.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.sendMagicLinkEmail('example@email.com')
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Logs in an existing user using their email address.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ The email address of the user.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -86,7 +86,7 @@ The password of the user.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signInWithEmail('example@email.com', 'example-password')
|
||||
```
|
||||
|
||||
@@ -102,4 +102,4 @@ Not yet implemented
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
</Tabs>
|
||||
@@ -25,7 +25,7 @@ Removes a logged-in session.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -65,7 +65,7 @@ A valid, logged-in JWT.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signOut(access_token)
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Creates a new user using their email address.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ The email address of the user.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -86,7 +86,7 @@ The password of the user.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signUpWithEmail('example@email.com', 'example-password')
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Updates the user data.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ A valid, logged-in JWT.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
UserAttributes
|
||||
<code>UserAttributes</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -86,7 +86,7 @@ The data you want to update.
|
||||
<TabItem value="js">
|
||||
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.updateUser(access_token, { password : 'Why Shinji?' })
|
||||
```
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const auth = new GoTrueClient({
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
object
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -78,7 +78,7 @@ No description provided.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
| |
|
||||
<code>undefined</code> | <code>false</code> | <code>true</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -99,7 +99,7 @@ Set to "true" if you want to automatically refresh the token before expiring.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
| |
|
||||
<code>undefined</code> | <code>false</code> | <code>true</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -120,7 +120,7 @@ Set to "true" if you want to automatically detects OAuth grants in the URL and s
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>reflection</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -141,7 +141,7 @@ Any additional headers to send to the GoTrue server.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
Storage
|
||||
<code>Storage</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -162,7 +162,7 @@ No description provided.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
| |
|
||||
<code>undefined</code> | <code>false</code> | <code>true</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -183,7 +183,7 @@ Set to "true" if you want to automatically save the user session into local stor
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -56,7 +56,7 @@ const { user, error } = await auth.signIn({
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
object
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -77,7 +77,7 @@ The user login details.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -98,7 +98,7 @@ The user's email address.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -119,7 +119,7 @@ The user's password.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
Provider
|
||||
<code>Provider</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -25,7 +25,7 @@ Creates a new user.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
object
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ The user login details.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -67,7 +67,7 @@ The user's password.
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -49,7 +49,7 @@ const { user, error } = await auth.update({
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
UserAttributes
|
||||
<code>UserAttributes</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -25,7 +25,7 @@ Disconnects the socket.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>number</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ A numeric status code to send on disconnect.
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
|
|
||||
<code>undefined</code> | <code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -25,7 +25,7 @@ Initializes the Socket
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
string
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
@@ -46,7 +46,7 @@ The string WebSocket endpoint, ie, "ws://example.com/socket", "wss://example.com
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
Options
|
||||
<code>Options</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
@@ -6673,7 +6673,7 @@
|
||||
"isExported": true
|
||||
},
|
||||
"comment": {
|
||||
"shortText": "Sends a reset request to an email address."
|
||||
"shortText": "<Tabs\n defaultValue=\"js\"\n groupId=\"libraries\"\n values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>\n\n<TabItem value=\"js\">\n\n```js\nconst { data, error } = supabase.auth.api.resetPasswordForEmail('user@email.com')\n```\n\n\n</TabItem>\n<TabItem value=\"py\">\n\n```py\n# Not yet implemented\n```\n\n\n</TabItem>\n\n</Tabs>\n\nSends a reset request to an email address.\n\nWhen the user clicks the reset link in the email they will be forwarded to:\n`<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery`\n\nYour app must detect `type=recovery` in the fragment and display a password reset form to the user.\n\nYou should then use the access_token in the url and new password to update the user as follows:\n\n```js\nconst { error, data } = await auth.api\n .updateUser(access_token, { password : new_password })\n```"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
|
||||
@@ -872,7 +872,7 @@
|
||||
"isExported": true
|
||||
},
|
||||
"comment": {
|
||||
"shortText": "Sends a reset request to an email address."
|
||||
"shortText": "<Tabs\n defaultValue=\"js\"\n groupId=\"libraries\"\n values={[{ label: 'JavaScript', value: 'js' },{ label: 'Python', value: 'py' }]}>\n\n<TabItem value=\"js\">\n\n```js\nconst { data, error } = supabase.auth.api.resetPasswordForEmail('user@email.com')\n```\n\n\n</TabItem>\n<TabItem value=\"py\">\n\n```py\n# Not yet implemented\n```\n\n\n</TabItem>\n\n</Tabs>\n\nSends a reset request to an email address.\n\nWhen the user clicks the reset link in the email they will be forwarded to:\n`<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery`\n\nYour app must detect `type=recovery` in the fragment and display a password reset form to the user.\n\nYou should then use the access_token in the url and new password to update the user as follows:\n\n```js\nconst { error, data } = await auth.api\n .updateUser(access_token, { password : new_password })\n```"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
|
||||
+9
-9
@@ -182,7 +182,7 @@ pages:
|
||||
- name: Sign up a new user with email
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signUpWithEmail('example@email.com', 'example-password')
|
||||
```
|
||||
|
||||
@@ -192,7 +192,7 @@ pages:
|
||||
- name: Sign in a user with email
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signInWithEmail('example@email.com', 'example-password')
|
||||
```
|
||||
|
||||
@@ -202,7 +202,7 @@ pages:
|
||||
- name: Send user a passwordless login link via email
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.sendMagicLinkEmail('example@email.com')
|
||||
```
|
||||
|
||||
@@ -212,7 +212,7 @@ pages:
|
||||
- name: Send a user an invite link to sign up via email
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.inviteUserByEmail('example@email.com')
|
||||
```
|
||||
|
||||
@@ -222,7 +222,7 @@ pages:
|
||||
- name: Send a user a password reset email
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.resetPasswordForEmail('example@email.com')
|
||||
```
|
||||
|
||||
@@ -232,7 +232,7 @@ pages:
|
||||
- name: Sign a user out
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.signOut(access_token)
|
||||
```
|
||||
|
||||
@@ -242,7 +242,7 @@ pages:
|
||||
- name: Get the user details for a given user
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.getUser(access_token)
|
||||
```
|
||||
|
||||
@@ -252,7 +252,7 @@ pages:
|
||||
- name: Update user info that Gotrue holds (also used for setting new passwords)
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.updateUser(access_token, { password : 'Why Shinji?' })
|
||||
```
|
||||
|
||||
@@ -262,6 +262,6 @@ pages:
|
||||
- name: Get a new access and refresh token using a valid refresh_token
|
||||
js: |
|
||||
```js
|
||||
const { error, data } = await api
|
||||
const { error, data } = await auth.api
|
||||
.refreshAccessToken(refresh_token)
|
||||
```
|
||||
Reference in new issue
Block a user