From f4369d55e518fbe74b7697427838b05e2172caf9 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Tue, 16 May 2023 16:51:40 +0800 Subject: [PATCH] update google & azure oauth guide --- .../guides/auth/social-login/auth-azure.mdx | 15 +++++++++++++ .../guides/auth/social-login/auth-google.mdx | 22 ++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/apps/docs/pages/guides/auth/social-login/auth-azure.mdx b/apps/docs/pages/guides/auth/social-login/auth-azure.mdx index 57f398456b0..d2ee9f865f7 100644 --- a/apps/docs/pages/guides/auth/social-login/auth-azure.mdx +++ b/apps/docs/pages/guides/auth/social-login/auth-azure.mdx @@ -91,6 +91,21 @@ async function signout() { } ``` +## Obtain the provider refresh token + +Azure OAuth2.0 doesn't return the `provider_refresh_token` by default. If you need the `provider_refresh_token` returned, you will need to include the following scope: + +```js +async function signInWithAzure() { + const { data, error } = await supabase.auth.signInWithOAuth({ + provider: 'azure', + options: { + scopes: 'offline_access', + }, + }) +} +``` + ## Resources - [Azure Developer Account](https://portal.azure.com) diff --git a/apps/docs/pages/guides/auth/social-login/auth-google.mdx b/apps/docs/pages/guides/auth/social-login/auth-google.mdx index 0e9cbe5fc3d..f4afe453b52 100644 --- a/apps/docs/pages/guides/auth/social-login/auth-google.mdx +++ b/apps/docs/pages/guides/auth/social-login/auth-google.mdx @@ -83,6 +83,18 @@ async function signInWithGoogle() { } ``` +You can view the full list of query parameters and their descriptions [here](https://developers.google.com/identity/protocols/oauth2/web-server#creatingclient). + +When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage: + +```js +async function signout() { + const { error } = await supabase.auth.signOut() +} +``` + +## Obtain the provider refresh token + Google OAuth2.0 doesn't return the `provider_refresh_token` by default. If you need the `provider_refresh_token` returned, you will need to add additional query parameters: ```js @@ -99,16 +111,6 @@ async function signInWithGoogle() { } ``` -You can view the full list of query parameters and their descriptions [here](https://developers.google.com/identity/protocols/oauth2/web-server#creatingclient). - -When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage: - -```js -async function signout() { - const { error } = await supabase.auth.signOut() -} -``` - ## Resources - [Supabase Account - Free Tier OK](https://supabase.com)