Skip to content

Commit

Permalink
fix(ui): allow passing oauth scopes for google sign in (#8368)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky committed Mar 31, 2022
1 parent 41bb980 commit 7edbf5e
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ abstract class GoogleProvider extends OAuthProvider {}
class GoogleProviderImpl extends GoogleProvider with SignOutMixin {
String clientId;
String redirectUri;
List<String> scopes;

late final provider = GoogleSignIn(clientId: clientId);
late final provider = GoogleSignIn(
clientId: clientId,
scopes: scopes,
);

@override
final GoogleAuthProvider firebaseAuthProvider = GoogleAuthProvider();
Expand All @@ -34,11 +38,13 @@ class GoogleProviderImpl extends GoogleProvider with SignOutMixin {
late final desktopSignInArgs = GoogleSignInArgs(
clientId: clientId,
redirectUri: redirectUri,
scope: scopes.join(' '),
);

GoogleProviderImpl({
required this.clientId,
required this.redirectUri,
this.scopes = const [],
}) {
firebaseAuthProvider.setCustomParameters(_firebaseAuthProviderParameters);
}
Expand Down Expand Up @@ -79,15 +85,18 @@ class GoogleProviderConfiguration
extends OAuthProviderConfiguration<GoogleProvider> {
final String clientId;
final String? redirectUri;
final List<String> scopes;

GoogleProviderImpl get _provider => GoogleProviderImpl(
clientId: clientId,
redirectUri: redirectUri ?? defaultRedirectUri,
scopes: scopes,
);

const GoogleProviderConfiguration({
required this.clientId,
this.redirectUri,
this.scopes = const [],
});

@override
Expand Down

0 comments on commit 7edbf5e

Please sign in to comment.