The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: update auth docs
Kang Ming03e4840cba8b
diff --git a/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx b/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdxindex 04022857529..05b02be5a3f 100644--- a/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx+++ b/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx@@ -10,6 +10,12 @@ import TabItem from '@theme/TabItem'Sends an invite link to an email address.+```js+const { data, error } = await supabase.auth.admin.inviteUserByEmail(+)+```+## Parameters<ul className="method-list-group">diff --git a/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx b/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdxindex 7a6d34d80ae..a55efaa8800 100644--- a/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx+++ b/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx@@ -13,7 +13,7 @@ Updates the user data.```jsconst { data: user, error } = await supabase.auth.admin.updateUserById('6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { email: '[email protected]' }+ { user_metadata: { hello: 'world' } })```diff --git a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx b/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdxindex 61a4002a9c3..69afe49fd83 100644--- a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx+++ b/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx@@ -10,6 +10,12 @@ import TabItem from '@theme/TabItem'Log in an existing user via a third-party provider.+```js+const { data, error } = await supabase.auth.signInWithOAuth({+ provider: 'github',+})+```+## Parameters<ul className="method-list-group">diff --git a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx b/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdxindex bd7abe414af..58126dfe0b9 100644--- a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx+++ b/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx@@ -10,6 +10,13 @@ import TabItem from '@theme/TabItem'Log in an existing user, or login via a third-party provider.+```js+const { data, error } = await supabase.auth.signInWithPassword({+ email: '[email protected]',+ password: 'example-password',+})+```+## Parameters<ul className="method-list-group">@@ -149,3 +156,33 @@ Verification token received when the user completes the captcha on the site.## Notes- Requires either an email and password or a phone number and password.++## Examples++### Sign in with Email.++Sign in with email and password. After a user has verified their email, they can use the [`signInWithPassword()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.++```js+const { data, error } = await supabase.auth.signInWithPassword({+ email: '[email protected]',+ password: 'example-password',+})+```++### Sign in with Phone.++Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.++```js+const { data, error } = await supabase.auth.signInWithPassword({+ phone: '+13334445555',+ password: 'some-password',+})++// After receiving an SMS with One Time Password.+let { data, error } = await supabase.auth.verifyOtp({+ phone: '+13334445555',+ token: '123456',+})+```diff --git a/apps/reference/_supabase_js/generated/auth-updateuser.mdx b/apps/reference/_supabase_js/generated/auth-updateuser.mdxindex 6d684ad1781..6d7030cc734 100644--- a/apps/reference/_supabase_js/generated/auth-updateuser.mdx+++ b/apps/reference/_supabase_js/generated/auth-updateuser.mdx@@ -11,8 +11,8 @@ import TabItem from '@theme/TabItem'Updates user data, if there is a logged in user.```js-const { data, error } = await supabase.auth.updateUser({- email: '[email protected]',+const { user, error } = await supabase.auth.updateUser({+ data: { hello: 'world' },})```diff --git a/apps/reference/_supabase_js/generated/auth-verifyotp.mdx b/apps/reference/_supabase_js/generated/auth-verifyotp.mdxnew file mode 100644index 00000000000..0c208f4706e--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-verifyotp.mdx@@ -0,0 +1,136 @@+---+id: auth-verifyotp+title: 'verifyOtp()'+slug: /auth-verifyotp+custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++Log in a user given a User supplied OTP received via mobile.++```js+const { data, error } = await supabase.auth.verifyOtp({+ phone,+ token,+ type: 'sms',+})+```++## Parameters++<ul className="method-list-group">++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ VerifyOtpParams+ </span>+ <span className="method-list-item-label-badge required">+ required+ </span>+ <span className="method-list-item-validation">+ <code>VerifyMobileOtpParams</code> | <code>VerifyEmailOtpParams</code>+ </span>+ </h4>+ <div class="method-list-item-description">++No description provided.++ </div>++<ul className="method-list-group">+ <h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>+</ul>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ options+ </span>+ <span className="method-list-item-label-badge required">+ required+ </span>+ <span className="method-list-item-validation">+ <code>object</code>+ </span>+ </h4>+ <div class="method-list-item-description">++No description provided.++ </div>++<ul className="method-list-group">+ <h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ captchaToken+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++Verification token received when the user completes the captcha on the site.++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ redirectTo+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++A URL to send the user to after they are confirmed.++ </div>++</li>++</ul>++</li>++</ul>++## Examples++### Verify Sms Otp++```js+const { data, error } = await supabase.auth.verifyOtp({+ phone,+ token,+ type: 'sms',+})+```++### Verify Signup Otp++```js+const { data, error } = await supabase.auth.verifyOtp({+ email,+ token,+ type: 'signup',+})+```diff --git a/apps/reference/nav/supabase_js_sidebars.js b/apps/reference/nav/supabase_js_sidebars.jsindex 14e4cbfcaad..6a2222e33ad 100644--- a/apps/reference/nav/supabase_js_sidebars.js+++ b/apps/reference/nav/supabase_js_sidebars.js@@ -38,6 +38,7 @@ const sidebars = {'generated/auth-signinwithotp','generated/auth-signinwithoauth','generated/auth-signout',+ 'generated/auth-verifyotp','generated/auth-getsession','generated/auth-getuser','generated/auth-updateuser',diff --git a/apps/www/next.config.js b/apps/www/next.config.jsindex 36703af7ae8..42a4979be14 100644--- a/apps/www/next.config.js+++ b/apps/www/next.config.js@@ -372,6 +372,11 @@ module.exports = withMDX({source: '/docs/client/auth-signout',destination: '/docs/reference/javascript/auth-signout',},+ {+ permanent: false,+ source: '/docs/client/auth-verifyotp',+ destination: '/docs/reference/javascript/auth-verifyotp',+ },{permanent: false,source: '/docs/client/auth-session',@@ -1431,6 +1436,11 @@ module.exports = withMDX({// },// {// permanent: true,+ // source: '/docs/reference/javascript/auth-api-verifyotp',+ // destination: '/docs/reference/javascript/auth-verifyotp',+ // },+ // {+ // permanent: true,// source: '/docs/reference/javascript/auth-api-listusers',// destination: '/docs/reference/javascript/auth-admin-listusers',// },diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.ymlindex e6208bcb81a..7277302a71c 100644--- a/spec/supabase_js_v2_legacy.yml+++ b/spec/supabase_js_v2_legacy.yml@@ -39,7 +39,7 @@ pages:})```- name: Sign up with additional user meta data.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data, error } = await supabase.auth.signUp(@@ -60,8 +60,9 @@ pages:$ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'notes: |- Requires either an email and password or a phone number and password.- example:+ examples:- name: Sign in with Email.+ isSpotlight: truedescription: |Sign in with email and password. After a user has verified their email, they can use the [`signInWithPassword()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.js: |@@ -72,6 +73,7 @@ pages:})```- name: Sign in with Phone.+ isSpotlight: falsedescription: |Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.js: |@@ -107,7 +109,7 @@ pages:})```- name: Sign in with sms otp.- isSpotlight: true+ isSpotlight: falsedescription: The user will be sent an otp to their phone number. By default, a given user can only request an otp once every 60 seconds.js: |```js@@ -123,6 +125,7 @@ pages:- Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).examples:- name: Sign in using a third-party provider.+ isSpotlight: truejs: |```jsconst { data, error } = await supabase.auth.signInWithOAuth({@@ -130,6 +133,7 @@ pages:})```- name: Sign in using a third-party provider with redirect.+ isSpotlight: falsedescription: |The `redirectTo` param will only applied on the callback made from the third-party provider. It does not redirect the user immediately after invoking this method.In order for the `redirectTo` param to be allowed, one needs to include it in an allowlist. Supabase supports this for@@ -144,6 +148,7 @@ pages:}```- name: Sign in with scopes.+ isSpotlight: falsedescription: |If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.@@ -167,6 +172,22 @@ pages:```jsconst { error } = await supabase.auth.signOut()```+ auth.verifyOtp():+ title: 'verifyOtp()'+ $ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp'+ examples:+ - name: Verify Sms Otp+ isSpotlight: true+ js: |+ ```js+ const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})+ ```+ - name: Verify Signup Otp+ isSpotlight: false+ js: |+ ```js+ const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'signup'})+ ```auth.getSession():title: 'getSession()'$ref: '@supabase/gotrue-js.GoTrueClient.getSession'@@ -191,7 +212,7 @@ pages:const user = supabase.auth.getUser()```- name: Get the logged in user with a custom access token jwt.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst user = supabase.auth.getUser(jwt)@@ -209,13 +230,13 @@ pages:examples:- name: Update email for authenticated user.description: Sends a "Confirm Email Change" email to the new email address.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data, error } = await supabase.auth.updateUser({email: '[email protected]'})```- name: Update password for authenticated user.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data, error } = await supabase.auth.updateUser({password: 'new password'})@@ -341,7 +362,6 @@ pages:})```- name: Auto-confirm email.- isSpotlight: truejs: |```jsconst { data, error } = await supabase.auth.admin.createUser({@@ -350,7 +370,6 @@ pages:})```- name: Auto-confirm phone.- isSpotlight: truejs: |```jsconst { data, error } = await supabase.auth.admin.createUser({@@ -382,7 +401,7 @@ pages:- This function should only be called on a server. Never expose your `service_role` key in the browser.examples:- name: Basic example.- isSpotlight: false+ isSpotlight: truejs: |```jsconst { data, error } = await supabase.auth.admin.inviteUserByEmail('[email protected]')@@ -435,7 +454,7 @@ pages:)```- name: Generate an invite link.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data, error } = await supabase.auth.admin.generateLink(@@ -452,7 +471,7 @@ pages:- This function should only be called on a server. Never expose your `service_role` key in the browser.examples:- name: Updates a user's email.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data: user, error } = await supabase.auth.admin.updateUserById(@@ -461,7 +480,7 @@ pages:)```- name: Updates a user's password.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data: user, error } = await supabase.auth.admin.updateUserById(@@ -479,7 +498,7 @@ pages:)```- name: Updates a user's app_metadata.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data: user, error } = await supabase.auth.admin.updateUserById(@@ -488,7 +507,7 @@ pages:)```- name: Confirms a user's email address.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data: user, error } = await supabase.auth.admin.updateUserById(@@ -497,7 +516,7 @@ pages:)```- name: Confirms a user's phone number.- isSpotlight: true+ isSpotlight: falsejs: |```jsconst { data: user, error } = await supabase.auth.admin.updateUserById(