The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Merge branch 'chore/supabasejs_v2' into km/chore-update-auth-docs
Kang Ming4075bc845690
diff --cc apps/reference/_supabase_js/generated/auth-admin-createuser.mdxindex 00000000000,00000000000..20d8633252bnew file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-createuser.mdx@@@ -1,0 -1,0 +1,283 @@@++---++id: auth-admin-createuser++title: 'createUser()'++slug: /auth-admin-createuser++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'++++Creates a new user.++This function should only be called on a server. Never expose your `service_role` key in the browser.++++```js++const { data, error } = await supabase.auth.admin.createUser({++ email: '[email protected]',++ password: 'password',++ user_metadata: { name: 'Yoda' },++})++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ AdminUserAttributes++ </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">++ app_metadata++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for app_metadata that.++++Only a service role can modify.++++Can be any JSON that includes app-specific info, such as identity providers, roles, and other++access control information.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ data++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for user_metadata that a user can modify. Can be any JSON.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ </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">++++The user's email.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ email_change_token++ </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">++++An email change token.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ email_confirm++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>boolean</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++Sets if a user has confirmed their email address.++++Only a service role can modify.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ password++ </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">++++The user's password.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ phone++ </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">++++The user's phone.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ phone_confirm++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>boolean</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++Sets if a user has confirmed their phone number.++++Only a service role can modify.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ user_metadata++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for user_metadata.++++Can be any JSON.++++Only a service role can modify.++++Note: When using the GoTrueAdminApi and wanting to modify a user's user_metadata,++this attribute is used instead of UserAttributes data.++++ </div>++++</li>++++</ul>++++</li>++++</ul>++++## Notes++++- Requires a `service_role` key.++- This function should be called on a server. Never expose your `service_role` key in the browser.++- If you do not provide the `email_confirm` and `phone_confirm` options to this function, both will default to false.++++## Examples++++### Create a new user.++++```js++const { data, error } = await supabase.auth.admin.createUser({++ email: '[email protected]',++ password: 'password',++ user_metadata: { name: 'Yoda' },++})++```++++### Auto-confirm email.++++```js++const { data, error } = await supabase.auth.admin.createUser({++ email: '[email protected]',++ email_confirm: true,++})++```++++### Auto-confirm phone.++++```js++const { data, error } = await supabase.auth.admin.createUser({++ phone: '1234567890',++ phone_confirm: true,++})++```diff --cc apps/reference/_supabase_js/generated/auth-admin-deleteuser.mdxindex 00000000000,00000000000..637e8524f4enew file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-deleteuser.mdx@@@ -1,0 -1,0 +1,60 @@@++---++id: auth-admin-deleteuser++title: 'deleteUser()'++slug: /auth-admin-deleteuser++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'++++Delete a user. Requires a `service_role` key.++++```js++const { data, error } = await supabase.auth.admin.deleteUser(++ '715ed5db-f090-4b8c-a067-640ecee36aa0'++)++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ uid++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>string</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++The user uid you want to remove.++++This function should only be called on a server. Never expose your `service_role` key in the browser.++++ </div>++++</li>++++</ul>++++## Notes++++- Requires a `service_role` key.++- This function should be called on a server. Never expose your `service_role` key in the browser.++++## Examples++++### Remove a user completely.++++```js++const { data, error } = await supabase.auth.admin.deleteUser(++ '715ed5db-f090-4b8c-a067-640ecee36aa0'++)++```diff --cc apps/reference/_supabase_js/generated/auth-admin-generatelink.mdxindex 00000000000,00000000000..c39e78a2a36new file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-generatelink.mdx@@@ -1,0 -1,0 +1,184 @@@++---++id: auth-admin-generatelink++title: 'generateLink()'++slug: /auth-admin-generatelink++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'++++Generates links to be sent via email or other.++++```js++const { data, error } = await supabase.auth.admin.generateLink(++ '[email protected]'++ 'signup',++ {++ 'password': 'secret'++ }++)++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ GenerateLinkType++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>signup</code> | <code>invite</code> | <code>magiclink</code> | <code>recovery</code> | <code>email_change_current</code> | <code>email_change_new</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++The link type++++ </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">++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>string</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++The user's email.++++ </div>++++</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">++ data++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++Optional user metadata. For signup only.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ password++ </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">++++User password. For signup only.++++ </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">++++The redirect url which should be appended to the generated link++++ </div>++++</li>++++</ul>++++</li>++++</ul>++++## Notes++++- Requires a `service_role` key.++- This function should only be called on a server. Never expose your `service_role` key in the browser.++++## Examples++++### Generate a signup link.++++```js++const { data, error } = await supabase.auth.admin.generateLink(++ '[email protected]'++ 'signup',++ {++ 'password': 'secret'++ }++)++```++++### Generate an invite link.++++```js++const { data, error } = await supabase.auth.admin.generateLink(++ '[email protected]'++ 'invite',++)++```diff --cc apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdxindex 00000000000,00000000000..679a72505cfnew file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdx@@@ -1,0 -1,0 +1,57 @@@++---++id: auth-admin-getuserbyid++title: 'getUserById()'++slug: /auth-admin-getuserbyid++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'++++Get user by id.++++```js++const { user, error } = await supabase.auth.admin.getUserById(1)++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ uid++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>string</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++The user's unique identifier++++This function should only be called on a server. Never expose your `service_role` key in the browser.++++ </div>++++</li>++++</ul>++++## Notes++++- Fetches the user object from the database instead of local storage.++- Note that user() fetches the user object from local storage which might not be the most updated.++- Requires the user's access_token.++++## Examples++++### Fetch the user object using the access_token jwt.++++```js++const { user, error } = await supabase.auth.admin.getUserById(1)++```diff --cc apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdxindex 5359e8b0aa2,00000000000..04022857529mode 100644,000000..100644--- a/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx+++ b/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx@@@ -1,115 -1,0 +1,117 @@@+---- id: auth-api-sendmobileotp- title: 'sendMobileOTP()'- slug: /auth-api-sendmobileotp++id: auth-admin-inviteuserbyemail++title: 'inviteUserByEmail()'++slug: /auth-admin-inviteuserbyemail+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'+- Sends a mobile OTP via SMS. Will register the account if it doesn't already exist++Sends an invite link to an email address.++## Parameters++<ul className="method-list-group">++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">- phone+ </span>+ <span className="method-list-item-label-badge required">+ required+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">+- The user's phone number WITH international prefix++The email address of the user.++ </div>++</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++ data+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">- <code>string</code>++ <code>object</code>+ </span>+ </h4>+ <div class="method-list-item-description">+- No description provided.++Optional user metadata++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">- shouldCreateUser++ redirectTo+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">- <code>boolean</code>++ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">+- A boolean flag to indicate whether to automatically create a user on magiclink / otp sign-ins if the user doesn't exist. Defaults to true.++A URL or mobile address to send the user to after they are confirmed.++ </div>++</li>++</ul>++</li>++</ul>++## Notes++- Requires a `service_role` key.+- This function should only be called on a server. Never expose your `service_role` key in the browser.++## Examples++### Basic example.++```js- const { data: user, error } = await supabase.auth.api.sendMobileOTP('12345879')++const { data, error } = await supabase.auth.admin.inviteUserByEmail(++ '[email protected]'++)+```diff --cc apps/reference/_supabase_js/generated/auth-admin-listusers.mdxindex 00000000000,00000000000..ffaaef8e50dnew file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-listusers.mdx@@@ -1,0 -1,0 +1,30 @@@++---++id: auth-admin-listusers++title: 'listUsers()'++slug: /auth-admin-listusers++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'++++Get a list of users.++++This function should only be called on a server. Never expose your `service_role` key in the browser.++++```js++const { data: user, error } = await supabase.auth.admin.listUsers()++```++++## Notes++++- Requires a `service_role` key.++- This function should be called on a server. Never expose your `service_role` key in the browser.++++## Examples++++### Get a full list of users.++++```js++const { data: user, error } = await supabase.auth.admin.listUsers()++```diff --cc apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdxindex 00000000000,00000000000..7a6d34d80aenew file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx@@@ -1,0 -1,0 +1,326 @@@++---++id: auth-admin-updateuserbyid++title: 'updateUserById()'++slug: /auth-admin-updateuserbyid++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'++++Updates the user data.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { email: '[email protected]' }++)++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ uid++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>string</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++No description provided.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ AdminUserAttributes++ </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">++ app_metadata++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for app_metadata that.++++Only a service role can modify.++++Can be any JSON that includes app-specific info, such as identity providers, roles, and other++access control information.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ data++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for user_metadata that a user can modify. Can be any JSON.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ </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">++++The user's email.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ email_change_token++ </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">++++An email change token.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ email_confirm++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>boolean</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++Sets if a user has confirmed their email address.++++Only a service role can modify.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ password++ </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">++++The user's password.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ phone++ </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">++++The user's phone.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ phone_confirm++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>boolean</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++Sets if a user has confirmed their phone number.++++Only a service role can modify.++++ </div>++++</li>++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ user_metadata++ </span>++ <span className="method-list-item-label-badge false">++ optional++ </span>++ <span className="method-list-item-validation">++ <code>object</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++A custom data object for user_metadata.++++Can be any JSON.++++Only a service role can modify.++++Note: When using the GoTrueAdminApi and wanting to modify a user's user_metadata,++this attribute is used instead of UserAttributes data.++++ </div>++++</li>++++</ul>++++</li>++++</ul>++++## Notes++++- Requires a `service_role` key.++- This function should only be called on a server. Never expose your `service_role` key in the browser.++++## Examples++++### Updates a user's email.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { email: '[email protected]' }++)++```++++### Updates a user's password.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { password: 'new_password' }++)++```++++### Updates a user's metadata.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { user_metadata: { hello: 'world' } }++)++```++++### Updates a user's app_metadata.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { app_metadata: { plan: 'trial' } }++)++```++++### Confirms a user's email address.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { email_confirm: true }++)++```++++### Confirms a user's phone number.++++```js++const { data: user, error } = await supabase.auth.admin.updateUserById(++ '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',++ { phone_confirm: true }++)++```diff --cc apps/reference/_supabase_js/generated/auth-getsession.mdxindex 5b4fcf0a18d,5d8d38d679f..0a490a10c04--- a/apps/reference/_supabase_js/generated/auth-getsession.mdx+++ b/apps/reference/_supabase_js/generated/auth-getsession.mdx@@@ -9,9 -9,10 +9,10 @@@ import Tabs from '@theme/Tabsimport TabItem from '@theme/TabItem'Returns the session data, refreshing it if necessary.+ If no session is detected, the session returned will be null.```js-const session = supabase.auth.session()+const { data, error } = supabase.auth.getSession()```## Examplesdiff --cc apps/reference/_supabase_js/generated/auth-getuser.mdxindex a7186032c96,70cae039358..eecf7850f6f--- a/apps/reference/_supabase_js/generated/auth-getuser.mdx+++ b/apps/reference/_supabase_js/generated/auth-getuser.mdx@@@ -8,16 -8,41 +8,42 @@@ custom_edit_url: https://github.com/supimport Tabs from '@theme/Tabs'import TabItem from '@theme/TabItem'- Returns the user data, refreshing the session if necessary.+ Gets the current user details if there is an existing session.```js-const user = await supabase.auth.getUser()+const user = supabase.auth.getUser()```+ ## Parameters++ <ul className="method-list-group">++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ jwt+ </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">++ Takes in an optional access token jwt. If no jwt is provided, getUser() will attempt to get the jwt from the current session.++ </div>++ </li>++ </ul>+## Notes-This method gets the user object from memory.+- This method gets the user object using the current session.+- Fetches the user object from the database instead of local storage.## Examplesdiff --cc apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdxindex 00000000000,00000000000..ebdec52c8f0new file mode 100644--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdx@@@ -1,0 -1,0 +1,136 @@@++---++id: auth-resetpasswordforemail++title: 'resetPasswordForEmail()'++slug: /auth-resetpasswordforemail++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'++++Sends a reset request to an email address.++++```js++const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {++ redirectTo: 'https://example.com/update-password',++})++```++++## Parameters++++<ul className="method-list-group">++++<li className="method-list-item">++ <h4 className="method-list-item-label">++ <span className="method-list-item-label-name">++ </span>++ <span className="method-list-item-label-badge required">++ required++ </span>++ <span className="method-list-item-validation">++ <code>string</code>++ </span>++ </h4>++ <div class="method-list-item-description">++++The email address of the user.++++ </div>++++</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>++++## Notes++++Sends a reset request to an email address.++++When the user clicks the reset link in the email they will be forwarded to the site url or the redirect url specified:++++`<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:++++```js++const { error, data } = await supabase.auth.updateUser({++ password: new_password,++})++```++++## Examples++++### Reset password++++```js++const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {++ redirectTo: 'https://example.com/update-password',++})++```diff --cc apps/reference/_supabase_js/generated/auth-setsession.mdxindex 644f46af9a9,8620b77dac4..7b6da3a7aa0--- a/apps/reference/_supabase_js/generated/auth-setsession.mdx+++ b/apps/reference/_supabase_js/generated/auth-setsession.mdx@@@ -8,10 -8,19 +8,10 @@@ custom_edit_url: https://github.com/supimport Tabs from '@theme/Tabs'import TabItem from '@theme/TabItem'- Sets the session data from refresh_token and returns current Session and Error+ Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid.```js-function apiFunction(req, res) {- // Assuming the access token was sent as a header "X-Supabase-Auth"- const { access_token } = req.get('X-Supabase-Auth')-- // You can now use it within a Supabase Client- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")- const { user, error } = supabase.auth.setAuth(access_token)-- // This client will now send requests as this user- const { data } = await supabase.from('your_table').select()+ const { data, error } = supabase.auth.setSession(refresh_token)}```diff --cc apps/reference/_supabase_js/generated/auth-updateuser.mdxindex 00000000000,fa19294716f..6d684ad1781mode 000000,100644..100644--- a/apps/reference/_supabase_js/generated/auth-updateuser.mdx+++ b/apps/reference/_supabase_js/generated/auth-updateuser.mdx@@@ -1,0 -1,184 +1,184 @@@+ ---+ id: auth-updateuser+ title: 'updateUser()'+ slug: /auth-updateuser+ 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'++ Updates user data, if there is a logged in user.++ ```js-const { user, error } = await supabase.auth.updateUser({++const { data, error } = await supabase.auth.updateUser({+ email: '[email protected]',+ })+ ```++ ## Parameters++ <ul className="method-list-group">++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ UserAttributes+ </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">+ data+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>object</code>+ </span>+ </h4>+ <div class="method-list-item-description">++ A custom data object for user_metadata that a user can modify. Can be any JSON.++ </div>++ </li>++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ </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">++ The user's email.++ </div>++ </li>++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ email_change_token+ </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">++ An email change token.++ </div>++ </li>++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ password+ </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">++ The user's password.++ </div>++ </li>++ <li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ phone+ </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">++ The user's phone.++ </div>++ </li>++ </ul>++ </li>++ </ul>++ ## Notes++ User email: Email updates will send an email to both the user's current and new email with a confirmation link by default.+ To toggle this behavior off and only send a single confirmation link to the new email, toggle "Double confirm email changes" under "Authentication" -> "Settings" off.++ User metadata: It's generally better to store user data in a table inside your public schema (i.e. `public.users`).+ Use the `update()` method if you have data which rarely changes or is specific only to the logged in user.++ ## Examples++ ### Update email for authenticated user.++ Sends a "Confirm Email Change" email to the new email address.++ ```js-const { user, error } = await supabase.auth.updateUser({++const { data, error } = await supabase.auth.updateUser({+ email: '[email protected]',+ })+ ```++ ### Update password for authenticated user.++ ```js-const { user, error } = await supabase.auth.updateUser({++const { data, error } = await supabase.auth.updateUser({+ password: 'new password',+ })+ ```++ ### Update a user's metadata.++ ```js+ const { user, error } = await supabase.auth.updateUser({+ data: { hello: 'world' },+ })+ ```diff --cc spec/supabase_js_v2_legacy.ymlindex 932d7d0b866,8de074fbbbe..1bcac7c546c--- a/spec/supabase_js_v2_legacy.yml+++ b/spec/supabase_js_v2_legacy.yml@@@ -294,7 -481,22 +294,22 @@@ pagesif (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)})```- auth.api.getUserById():++ auth.admin.getUserById():+ title: 'getUserById()'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.getUserById'+ notes: |+ - Fetches the user object from the database instead of local storage.+ - Note that user() fetches the user object from local storage which might not be the most updated.+ - Requires the user's access_token.+ examples:+ - name: Fetch the user object using the access_token jwt.+ isSpotlight: true+ js: |+ ```js- const { user, error } = await supabase.auth.api.getUserById(1)++ const { user, error } = await supabase.auth.admin.getUserById(1)+ ```+- auth.api.listUsers():+ auth.admin.listUsers():title: 'listUsers()'$ref: '@supabase/gotrue-js.GoTrueAdminApi.listUsers'notes: |