The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Update password reset details in new ref docs
dannykng89d1581b7559
diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.ymlindex 0925a05d134..450204cde24 100644--- a/spec/supabase_js_v2_legacy.yml+++ b/spec/supabase_js_v2_legacy.yml@@ -478,27 +478,42 @@ pages:title: 'resetPasswordForEmail()'$ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'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:-+ Sends a 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- const { error, data } = await supabase.auth.updateUser({ password : new_password })+ const { data, error } = await supabase.auth+ .update({ password: new_password })```examples:- - name: Reset password- isSpotlight: true+ - name: Reset Password (React)+ isSpotlight: falsejs: |```js- const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {- redirectTo: 'https://example.com/update-password',- })+ /**+ * 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]')++ /**+ * 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.")+ }+ })+ }, [])```auth.admin.generateLink():