Skip to content

Commit 616d77b

Browse files
Update SupaSocialsAuth to pass scopes and query params to signInWithOAuth (supabase-community#71)
* Update SupaSocialsAuth to pass scopes and query params to signInWithOAuth Allows for triggering consent prompts. * Change the type of the scopes and queryParams so that different values can be passed for each providers --------- Co-authored-by: dshukertjr <[email protected]>
1 parent 7022cbd commit 616d77b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/src/components/supa_socials_auth.dart

+10
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ class SupaSocialsAuth extends StatefulWidget {
8585
/// Whether to show a SnackBar after a successful sign in
8686
final bool showSuccessSnackBar;
8787

88+
/// OpenID scope(s) for provider authorization request (ex. '.default')
89+
final Map<OAuthProvider, String>? scopes;
90+
91+
/// Parameters to include in provider authorization request (ex. {'prompt': 'consent'})
92+
final Map<OAuthProvider, Map<String, String>>? queryParams;
93+
8894
const SupaSocialsAuth({
8995
Key? key,
9096
required this.socialProviders,
@@ -94,6 +100,8 @@ class SupaSocialsAuth extends StatefulWidget {
94100
this.onError,
95101
this.socialButtonVariant = SocialButtonVariant.iconAndText,
96102
this.showSuccessSnackBar = true,
103+
this.scopes,
104+
this.queryParams,
97105
}) : super(key: key);
98106

99107
@override
@@ -209,6 +217,8 @@ class _SupaSocialsAuthState extends State<SupaSocialsAuth> {
209217
await supabase.auth.signInWithOAuth(
210218
socialProvider,
211219
redirectTo: widget.redirectUrl,
220+
scopes: widget.scopes?[socialProvider],
221+
queryParams: widget.queryParams?[socialProvider],
212222
);
213223
} on AuthException catch (error) {
214224
if (widget.onError == null && context.mounted) {

0 commit comments

Comments
 (0)