The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Generate supabase-js v1 ref docs
dannyknga3616065c1cb
diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdxindex 8b62fc6e743..a36182e2850 100644--- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx+++ b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx@@ -8,7 +8,7 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_import Tabs from '@theme/Tabs'import TabItem from '@theme/TabItem'-Sends a reset request to an email address.+Sends a password reset request to an email address.```jsconst { data, error } = await supabase.auth.api.resetPasswordForEmail(@@ -110,17 +110,11 @@ No description provided.## NotesSends 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:+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-const { error, data } = await supabase.auth.api.updateUser(access_token, {+const { data, error } = await supabase.auth.update({password: new_password,})```@@ -134,3 +128,33 @@ const { data, error } = await supabase.auth.api.resetPasswordForEmail()```++### Reset password (React)++```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.+ */+const { data, error } = await supabase.auth.api.resetPasswordForEmail(+)++/**+ * Step 2: Once the user is redirected back to your application,+ * 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,+ })++ if (data) alert('Password updated successfully!')+ if (error) alert('There was an error updating your password.')+ }+ })+}, [])+```diff --git a/spec/enrichments/tsdoc_v1/combined.json b/spec/enrichments/tsdoc_v1/combined.jsonindex a39a614c4fa..ea4900370b3 100644--- a/spec/enrichments/tsdoc_v1/combined.json+++ b/spec/enrichments/tsdoc_v1/combined.json@@ -3851,7 +3851,7 @@"isExternal": true},"comment": {- "shortText": "Sends a reset request to an email address."+ "shortText": "Sends a password reset request to an email address."},"parameters": [{diff --git a/spec/enrichments/tsdoc_v2/combined.json b/spec/enrichments/tsdoc_v2/combined.jsonindex c3ec92e59bb..ec34e38365b 100644--- a/spec/enrichments/tsdoc_v2/combined.json+++ b/spec/enrichments/tsdoc_v2/combined.json@@ -8707,7 +8707,7 @@"isExternal": true},"comment": {- "shortText": "Sends a reset request to an email address."+ "shortText": "Sends a password reset request to an email address."},"parameters": [{diff --git a/spec/enrichments/tsdoc_v2/supabase.json b/spec/enrichments/tsdoc_v2/supabase.jsonindex ae462310da6..d21de9c06c2 100644--- a/spec/enrichments/tsdoc_v2/supabase.json+++ b/spec/enrichments/tsdoc_v2/supabase.json@@ -8340,7 +8340,7 @@"isExternal": true},"comment": {- "shortText": "Sends a reset request to an email address."+ "shortText": "Sends a password reset request to an email address."},"parameters": [{diff --git a/spec/enrichments/tsdoc_v2/supabase_dereferenced.json b/spec/enrichments/tsdoc_v2/supabase_dereferenced.jsonindex 100763c4c21..6cc1eaf36a4 100644--- a/spec/enrichments/tsdoc_v2/supabase_dereferenced.json+++ b/spec/enrichments/tsdoc_v2/supabase_dereferenced.json@@ -8704,7 +8704,7 @@"isExternal": true},"comment": {- "shortText": "Sends a reset request to an email address."+ "shortText": "Sends a password reset request to an email address."},"parameters": [{diff --git a/spec/supabase_js_v1_legacy.yml b/spec/supabase_js_v1_legacy.ymlindex d52ca3c2af1..283a4385605 100644--- a/spec/supabase_js_v1_legacy.yml+++ b/spec/supabase_js_v1_legacy.yml@@ -595,16 +595,18 @@ pages: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- const { data, error } = await supabase.auth- .update({ password: new_password })+ const { data, error } = await supabase.auth.update({+ password: new_password,+ })```examples:- name: Reset passwordisSpotlight: truejs: |```js- const { data, error } = await supabase.auth.api- .resetPasswordForEmail('[email protected]')+ const { data, error } = await supabase.auth.api.resetPasswordForEmail(+ )```- name: Reset password (React)isSpotlight: true@@ -614,25 +616,27 @@ pages:* 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.*/- const { data, error } = await supabase.auth- .resetPasswordForEmail('[email protected]')+ const { data, error } = await supabase.auth.api.resetPasswordForEmail(+ )/*** Step 2: Once the user is redirected back to your application,* 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 })-- if (data) alert("Password updated successfully!")- if (error) alert("There was an error updating your 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,+ })++ if (data) alert("Password updated successfully!")+ if (error) alert("There was an error updating your password.")+ }+ })+ }, [])```auth.api.generateLink():