Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: adds instructions for resetting password after email sent

awalias4829204d91e4
diff --git a/web/docs/client/auth-forgotpassword.mdx b/web/docs/client/auth-forgotpassword.mdx
index 88d443d08e4..0df4ea284e3 100644
--- a/web/docs/client/auth-forgotpassword.mdx
+++ b/web/docs/client/auth-forgotpassword.mdx
@@ -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('[email protected]')
+```
+
+
+</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
diff --git a/web/docs/client/auth-resetpasswordforemail.mdx b/web/docs/client/reset-password-email.mdx
similarity index 70%
rename from web/docs/client/auth-resetpasswordforemail.mdx
rename to web/docs/client/reset-password-email.mdx
index 4c12038ffac..e585ccb0bd6 100644
--- a/web/docs/client/auth-resetpasswordforemail.mdx
+++ b/web/docs/client/reset-password-email.mdx
@@ -1,14 +1,12 @@
---
-id: auth-resetpasswordforemail
-title: "auth.resetPasswordForEmail()"
-slug: auth-resetpasswordforemail
+id: reset-password-email
+title: "Reset Password (Email)"
+slug: reset-password-email
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-Sends a reset request to an email address.
-
<Tabs
defaultValue="js"
groupId="libraries"
@@ -33,6 +31,20 @@ const { data, error } = supabase.auth.api.resetPasswordForEmail('[email protected]'
</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
diff --git a/web/docs/gotrue/client/api-getuser.mdx b/web/docs/gotrue/client/api-getuser.mdx
index 07cbb8982b0..b8b15072fdd 100644
--- a/web/docs/gotrue/client/api-getuser.mdx
+++ b/web/docs/gotrue/client/api-getuser.mdx
@@ -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)
```
diff --git a/web/docs/gotrue/client/api-inviteuserbyemail.mdx b/web/docs/gotrue/client/api-inviteuserbyemail.mdx
index 950e3ef70ff..062b32fb50c 100644
--- a/web/docs/gotrue/client/api-inviteuserbyemail.mdx
+++ b/web/docs/gotrue/client/api-inviteuserbyemail.mdx
@@ -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('[email protected]')
```
diff --git a/web/docs/gotrue/client/api-refreshaccesstoken.mdx b/web/docs/gotrue/client/api-refreshaccesstoken.mdx
index 88cead7f477..4d65f1019ea 100644
--- a/web/docs/gotrue/client/api-refreshaccesstoken.mdx
+++ b/web/docs/gotrue/client/api-refreshaccesstoken.mdx
@@ -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)
```
diff --git a/web/docs/gotrue/client/api-resetpasswordforemail.mdx b/web/docs/gotrue/client/api-resetpasswordforemail.mdx
index 829d92eeed0..acc8b22c9ba 100644
--- a/web/docs/gotrue/client/api-resetpasswordforemail.mdx
+++ b/web/docs/gotrue/client/api-resetpasswordforemail.mdx
@@ -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
.resetPasswordForEmail('[email protected]')
```
diff --git a/web/docs/gotrue/client/api-sendmagiclinkemail.mdx b/web/docs/gotrue/client/api-sendmagiclinkemail.mdx
index 2eb33caf787..0f94d94044b 100644
--- a/web/docs/gotrue/client/api-sendmagiclinkemail.mdx
+++ b/web/docs/gotrue/client/api-sendmagiclinkemail.mdx
@@ -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('[email protected]')
```
diff --git a/web/docs/gotrue/client/api-signinwithemail.mdx b/web/docs/gotrue/client/api-signinwithemail.mdx
index 095331ad655..2fd3e8f9521 100644
--- a/web/docs/gotrue/client/api-signinwithemail.mdx
+++ b/web/docs/gotrue/client/api-signinwithemail.mdx
@@ -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('[email protected]', 'example-password')
```
diff --git a/web/docs/gotrue/client/api-signout.mdx b/web/docs/gotrue/client/api-signout.mdx
index 0a149798953..5665674b433 100644
--- a/web/docs/gotrue/client/api-signout.mdx
+++ b/web/docs/gotrue/client/api-signout.mdx
@@ -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)
```
diff --git a/web/docs/gotrue/client/api-signupwithemail.mdx b/web/docs/gotrue/client/api-signupwithemail.mdx
index 626c8078892..4e1c17b3f5f 100644
--- a/web/docs/gotrue/client/api-signupwithemail.mdx
+++ b/web/docs/gotrue/client/api-signupwithemail.mdx
@@ -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('[email protected]', 'example-password')
```
diff --git a/web/docs/gotrue/client/api-updateuser.mdx b/web/docs/gotrue/client/api-updateuser.mdx
index a3e4b578f60..77c77588221 100644
--- a/web/docs/gotrue/client/api-updateuser.mdx
+++ b/web/docs/gotrue/client/api-updateuser.mdx
@@ -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?' })
```
diff --git a/web/sidebar_spec_supabase.js b/web/sidebar_spec_supabase.js
index 68f9470cc49..6d72c6721ee 100644
--- a/web/sidebar_spec_supabase.js
+++ b/web/sidebar_spec_supabase.js
@@ -9,7 +9,7 @@ module.exports = {
{
type: 'category',
label: 'Auth',
- items: ['client/auth-signup', 'client/auth-signin', 'client/auth-signout', 'client/auth-session', 'client/auth-user', 'client/auth-update', 'client/auth-onauthstatechange', 'client/auth-resetpasswordforemail'],
+ items: ['client/auth-signup', 'client/auth-signin', 'client/auth-signout', 'client/auth-session', 'client/auth-user', 'client/auth-update', 'client/auth-onauthstatechange', 'client/reset-password-email'],
collapsed: false,
},
{
diff --git a/web/spec/gotrue.yml b/web/spec/gotrue.yml
index 74de4f0252b..78ce93b72d7 100644
--- a/web/spec/gotrue.yml
+++ b/web/spec/gotrue.yml
@@ -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('[email protected]', '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('[email protected]', '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('[email protected]')
```
@@ -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('[email protected]')
```
@@ -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('[email protected]')
```
@@ -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)
```
diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml
index 0698be8c052..1e57bca1e80 100644
--- a/web/spec/supabase.yml
+++ b/web/spec/supabase.yml
@@ -42,7 +42,7 @@ info:
- auth.user()
- auth.update()
- auth.onAuthStateChange()
- - auth.resetPasswordForEmail()
+ - Reset Password (Email)
- name: 'Data'
items:
- select()
@@ -361,7 +361,7 @@ pages:
# Not yet implemented
```
- auth.resetPasswordForEmail():
+ Reset Password (Email):
$ref: '@supabase/gotrue-js."GoTrueApi".GoTrueApi.resetPasswordForEmail'
examples:
- name: Reset password