From 2f082b1c56fa247bc8bb7445afb39e12789e58d1 Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Tue, 3 Sep 2024 16:13:47 +0200 Subject: [PATCH] Refactored Scopes for oAuth providers --- .../auth/src/components/oauth-providers.tsx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/features/auth/src/components/oauth-providers.tsx b/packages/features/auth/src/components/oauth-providers.tsx index 922d98477..11df96881 100644 --- a/packages/features/auth/src/components/oauth-providers.tsx +++ b/packages/features/auth/src/components/oauth-providers.tsx @@ -12,6 +12,20 @@ import { Trans } from '@kit/ui/trans'; import { AuthErrorAlert } from './auth-error-alert'; import { AuthProviderButton } from './auth-provider-button'; +/** + * @name OAUTH_SCOPES + * @description + * The OAuth scopes are used to specify the permissions that the application is requesting from the user. + * + * Please add your OAuth providers here and the scopes you want to use. + * + * @see https://supabase.com/docs/guides/auth/social-login + */ +const OAUTH_SCOPES: Partial> = { + azure: 'email', + // add your OAuth providers here +}; + export function OauthProviders(props: { inviteToken?: string; shouldCreateUser: boolean; @@ -75,13 +89,7 @@ export function OauthProviders(props: { ].join('?'); const redirectTo = [origin, redirectPath].join(''); - - const scopesOpts = - provider === 'azure' - ? { - scopes: 'email', - } - : {}; + const scopesOpts = OAUTH_SCOPES[provider] ?? {}; const credentials = { provider,