Skip to content

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

docs: update auth docs

Kang Ming6735b67945cc
diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.yml
index 194d64f1927..1a5e3fa4720 100644
--- a/spec/supabase_js_v2.yml
+++ b/spec/supabase_js_v2.yml
@@ -116,6 +116,15 @@ functions:
title: 'Overview'
notes: |
- The auth methods can be accessed via the `supabase.auth` namespace.
+ - By default, the supabase client sets `persistSession` to true and attempts to store the session in local storage. When using the supabase client in an environment that doesn't support local storage, you might notice the following warning message being logged:
+
+ > No storage option exists to persist the session, which may result in unexpected behavior when using auth.
+ If you want to set `persistSession` to true, please provide a storage option or you may set `persistSession` to false to disable this warning.
+
+ This warning message can be safely ignored if you're not using auth on the server-side. If you are using auth and you want to set `persistSession` to true, you will need to provide a custom storage implementation that follows [this interface](https://github.com/supabase/gotrue-js/blob/master/src/lib/types.ts#L1027).
+ - Any email links and one-time passwords (OTPs) sent have a default expiry of 24 hours. We have the following [rate limits](/docs/guides/platform/going-into-prod#auth-rate-limits) in place to guard against brute force attacks.
+ - The expiry of an access token can be set in the "JWT expiry limit" field in [your project's auth settings](/project/_/settings/auth). A refresh token never expires and can only be used once.
+
examples:
- id: create-auth-client
name: Create auth client
@@ -449,8 +458,9 @@ functions:
$ref: '@supabase/gotrue-js.GoTrueClient.updateUser'
notes: |
- In order to use the `updateUser()` method, the user needs to be signed in first.
- - By Default, email updates sends a confirmation link to both the user's current and new email.
- To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://supabase.com/dashboard/project/_/auth/providers).
+ - By default, email updates sends a confirmation link to both the user's current and new email.
+ To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](/project/_/auth/providers).
+
examples:
- id: update-the-email-for-an-authenticated-user
name: Update the email for an authenticated user
@@ -480,7 +490,8 @@ functions:
```
- id: update-password-with-reauthentication
name: Update the user's password with a nonce
- description: If "Secure password change" is enabled, updating the user's password would require a nonce. The nonce is sent to the user's email or phone number.
+ description: |
+ If **Secure password change** is enabled in your [project's email provider settings](/project/_/auth/providers), updating the user's password would require a nonce if the user **hasn't recently signed in**. The nonce is sent to the user's email or phone number. A user is deemed recently signed in if the session was created in the last 24 hours.
isSpotlight: true
code: |
```js
@@ -494,6 +505,8 @@ functions:
$ref: '@supabase/gotrue-js.GoTrueClient.reauthenticate'
notes: |
- This method is used together with `updateUser()` when a user's password needs to be updated.
+ - If you require your user to reauthenticate before updating their password, you need to enable the **Secure password change** option in your [project's email provider settings](/project/_/auth/providers).
+ - A user is only require to reauthenticate before updating their password if **Secure password change** is enabled and the user **hasn't recently signed in**. A user is deemed recently signed in if the session was created in the last 24 hours.
- This method will send a nonce to the user's email. If the user doesn't have a confirmed email address, the method will send the nonce to the user's confirmed phone number instead.
examples:
- id: send-reauthentication-nonce
@@ -980,7 +993,7 @@ functions:
$ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink'
notes: |
- The following types can be passed into `generateLink()`: `signup`, `magiclink`, `invite`, `recovery`, `email_change_current`, `email_change_new`, `phone_change`.
- - `generateLink()` only generates the email link for `email_change_email` if the "Secure email change" setting is enabled under the "Email" provider in your Supabase project.
+ - `generateLink()` only generates the email link for `email_change_email` if the **Secure email change** is enabled in your project's [email auth provider settings](/project/_/auth/providers).
- `generateLink()` handles the creation of the user for `signup`, `invite` and `magiclink`.
examples:
- id: generate-a-signup-link