Skip to content

Commit

Permalink
Update SupaSocialsAuth to pass scopes and query params to signInWithO…
Browse files Browse the repository at this point in the history
…Auth

Allows for triggering consent prompts.
  • Loading branch information
dannypurcell authored Jan 16, 2024
1 parent edd83a2 commit c9fae15
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/src/components/supa_socials_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class SupaSocialsAuth extends StatefulWidget {
/// Whether to show a SnackBar after a successful sign in
final bool showSuccessSnackBar;

/// OpenID scope(s) for provider authorization request (ex. '.default')
final String? scopes;

/// Parameters to include in provider authorization request (ex. {'prompt': 'consent'})
final Map<String, String>? queryParams;

const SupaSocialsAuth({
Key? key,
required this.socialProviders,
Expand All @@ -94,6 +100,8 @@ class SupaSocialsAuth extends StatefulWidget {
this.onError,
this.socialButtonVariant = SocialButtonVariant.iconAndText,
this.showSuccessSnackBar = true,
this.scopes,
this.queryParams,
}) : super(key: key);

@override
Expand Down Expand Up @@ -209,6 +217,8 @@ class _SupaSocialsAuthState extends State<SupaSocialsAuth> {
await supabase.auth.signInWithOAuth(
socialProvider,
redirectTo: widget.redirectUrl,
scopes: widget.scopes,
queryParams: widget.queryParams,
);
} on AuthException catch (error) {
if (widget.onError == null && context.mounted) {
Expand Down

0 comments on commit c9fae15

Please sign in to comment.