Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1.0

* Add hasRequestedScope method to determine if an Oauth scope has been granted.
* Add requestScope Method to request new Oauth scopes be granted by the user.

## 1.0.4

* Make the pedantic dev_dependency explicit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,12 @@ abstract class GoogleSignInPlatform {
Future<void> clearAuthCache({@required String token}) async {
throw UnimplementedError('clearAuthCache() has not been implemented.');
}

/// Requests the user grants additional Oauth [scopes].
///
/// Scopes should come from the full list
/// [here](https://developers.google.com/identity/protocols/googlescopes).
Future<bool> requestScopes(List<String> scopes) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what can be the values of the scopes? Maybe we should either make an enum or have some concrete list of what the values can be.

Copy link
Member

@ditman ditman Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyanglaz There's a TON of auth scopes, here's the list: https://developers.google.com/identity/protocols/googlescopes (each API that you want to use has its own set of scopes). In Java for example, each API may provide its set of scopes, and not the core plugin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add this link to the dartdoc?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a good point! It can probably be added to the README.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a link in the dartdoc. Looks like this is already mentioned in the README.md here.

throw UnimplementedError('requestScopes() has not been implmented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,12 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform {
<String, String>{'token': token},
);
}

@override
Future<bool> requestScopes(List<String> scopes) {
return channel.invokeMethod<bool>(
'requestScopes',
<String, List<String>>{'scopes': scopes},
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the google_sign_in plugin.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 1.0.4
version: 1.1.0

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ void main() {
}: isMethodCall('clearAuthCache', arguments: <String, dynamic>{
'token': 'abc',
}),
() {
googleSignIn.requestScopes(['newScope', 'anotherScope']);
}: isMethodCall('requestScopes', arguments: <String, dynamic>{
'scopes': ['newScope', 'anotherScope'],
}),
googleSignIn.signOut: isMethodCall('signOut', arguments: null),
googleSignIn.disconnect: isMethodCall('disconnect', arguments: null),
googleSignIn.isSignedIn: isMethodCall('isSignedIn', arguments: null),
Expand Down