Skip to content

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

Update examples

dannykng8998b6545191
diff --git a/spec/supabase_js_v1_legacy.yml b/spec/supabase_js_v1_legacy.yml
index be572a6cb77..d52ca3c2af1 100644
--- a/spec/supabase_js_v1_legacy.yml
+++ b/spec/supabase_js_v1_legacy.yml
@@ -591,7 +591,7 @@ pages:
title: 'resetPasswordForEmail()'
$ref: '@supabase/gotrue-js.GoTrueApi.resetPasswordForEmail'
notes: |
- Sends a reset request to an email address.
+ Sends a password reset request to an email address.
When the user clicks the reset link in the email they are redirected back to your application.
Prompt the user for a new password and call `auth.update()`:
```js
@@ -612,21 +612,20 @@ pages:
```js
/**
* Step 1: Send the user an email to get a password reset token.
- * This email contains a link which sends the user back to your application.
+ * This email contains a link which sends the user back to your application.
*/
const { data, error } = await supabase.auth
.resetPasswordForEmail('[email protected]')
/**
* Step 2: Once the user is redirected back to your application,
- * ask the user to reset their password.
+ * ask the user to reset their password.
*/
useEffect(() => {
supabase.auth.onAuthStateChange(async (event, session) => {
if (event == "PASSWORD_RECOVERY") {
const newPassword = prompt("What would you like your new password to be?");
- const { data, error } = await supabase
- .auth
+ const { data, error } = await supabase.auth
.update({ password: newPassword })
if (data) alert("Password updated successfully!")
diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.yml
index ee8d4f9d539..34be498ef04 100644
--- a/spec/supabase_js_v2_legacy.yml
+++ b/spec/supabase_js_v2_legacy.yml
@@ -478,12 +478,12 @@ pages:
title: 'resetPasswordForEmail()'
$ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'
notes: |
- Sends a reset request to an email address.
+ Sends a password reset request to an email address.
When the user clicks the reset link in the email they are redirected back to your application.
- Prompt the user for a new password and call `auth.update()`:
+ Prompt the user for a new password and call `auth.updateUser()`:
```js
const { data, error } = await supabase.auth
- .update({ password: new_password })
+ .updateUser({ password: new_password })
```
examples:
- name: Reset password
@@ -500,22 +500,21 @@ pages:
```js
/**
* Step 1: Send the user an email to get a password reset token.
- * This email contains a link which sends the user back to your application.
+ * This email contains a link which sends the user back to your application.
*/
const { data, error } = await supabase.auth
.resetPasswordForEmail('[email protected]')
/**
* Step 2: Once the user is redirected back to your application,
- * ask the user to reset their password.
+ * ask the user to reset their password.
*/
useEffect(() => {
supabase.auth.onAuthStateChange(async (event, session) => {
if (event == "PASSWORD_RECOVERY") {
const newPassword = prompt("What would you like your new password to be?");
- const { data, error } = await supabase
- .auth
- .update({ password: newPassword })
+ const { data, error } = await supabase.auth
+ .updateUser({ password: newPassword })
if (data) alert("Password updated successfully!")
if (error) alert("There was an error updating your password.")