1
1
import { Provider , SupabaseClient } from '@supabase/supabase-js'
2
2
import { useState } from 'react'
3
- import { I18nVariables , SocialLayout , template } from '@supabase/auth-ui-shared'
3
+ import {
4
+ I18nVariables ,
5
+ ProviderScopes ,
6
+ SocialLayout ,
7
+ template ,
8
+ } from '@supabase/auth-ui-shared'
4
9
import { Appearance } from '../../../types'
5
10
import { Button , Container , Divider } from './../../UI/index.js'
6
11
import * as SocialIcons from './../Icons.js'
@@ -9,6 +14,8 @@ interface SocialAuthProps {
9
14
supabaseClient : SupabaseClient
10
15
socialLayout ?: SocialLayout
11
16
providers ?: Provider [ ]
17
+ providerScopes ?: Partial < ProviderScopes >
18
+ queryParams ?: { [ key : string ] : string }
12
19
redirectTo ?: RedirectTo
13
20
onlyThirdPartyProviders ?: boolean
14
21
view ?: 'sign_in' | 'sign_up'
@@ -22,6 +29,8 @@ function SocialAuth({
22
29
supabaseClient,
23
30
socialLayout = 'vertical' ,
24
31
providers = [ 'github' , 'google' , 'azure' ] ,
32
+ providerScopes,
33
+ queryParams,
25
34
redirectTo,
26
35
onlyThirdPartyProviders = true ,
27
36
view = 'sign_in' ,
@@ -37,7 +46,11 @@ function SocialAuth({
37
46
setLoading ( true )
38
47
const { error } = await supabaseClient . auth . signInWithOAuth ( {
39
48
provider,
40
- options : { redirectTo } ,
49
+ options : {
50
+ redirectTo,
51
+ scopes : providerScopes ?. [ provider ] ,
52
+ queryParams,
53
+ } ,
41
54
} )
42
55
if ( error ) setError ( error . message )
43
56
setLoading ( false )
0 commit comments