Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[google_sign_in] Add ability to return serverAuthCode #2116

Merged
merged 40 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
36f7fd0
Update GoogleSignInPlugin.java
yamarkz Sep 27, 2019
9350ff9
Update GoogleSignInPlugin.m
yamarkz Sep 27, 2019
722959c
Update google_sign_in.dart
yamarkz Sep 27, 2019
55ce6a4
Update version number
yamarkz Sep 27, 2019
9efd8c4
Update AUTHORS
yamarkz Sep 27, 2019
73f6fa0
Update CHANGELOG.md
yamarkz Sep 27, 2019
df155e5
Update GoogleSignInPlugin.java
yamarkz Sep 27, 2019
66f969c
Update GoogleSignInPlugin.m
yamarkz Sep 27, 2019
3ed41e7
Update google_sign_in.dart
yamarkz Sep 27, 2019
97cbf5b
Update AUTHORS
yamarkz Sep 27, 2019
a24a547
Update CHANGELOG.md
yamarkz Sep 27, 2019
dba9fde
modify conflict
yamarkz Sep 27, 2019
beed787
modify variable assignment
yamarkz Nov 8, 2019
9eb338c
fix conflict
yamarkz Nov 8, 2019
5227ce8
add test case
yamarkz Nov 8, 2019
0cc73de
pubspec version up
yamarkz Nov 8, 2019
d77b480
Update CHANGELOG.md
yamarkz Nov 8, 2019
29d0503
fix conflict
yamarkz Nov 15, 2019
e4886ad
modify conflict
yamarkz Dec 16, 2019
3ce141f
Merge branch 'master' into server-auth-code
yamarkz Dec 16, 2019
5eaa11a
fix changelog conflict
yamarkz Jan 10, 2020
580b5a6
Merge branch 'master' into server-auth-code
yamarkz Mar 30, 2020
cbe903e
modify return values
yamarkz Mar 30, 2020
95a2969
modify conflict
yamarkz Mar 30, 2020
428a12f
modify conflict
yamarkz Apr 6, 2020
10d90fc
modify conflict
yamarkz Apr 8, 2020
7177136
update ios/android example code
yamarkz Apr 8, 2020
a1b3655
modify conflict
yamarkz Apr 24, 2020
7c7d0a7
update interface package version
yamarkz Apr 24, 2020
866e356
remove interface code
yamarkz Apr 24, 2020
1381e78
add attribute description comment
yamarkz Apr 24, 2020
39ce20b
remove extra line
yamarkz Apr 24, 2020
1c3b37b
remove unnecessary code
yamarkz Apr 24, 2020
42b6410
modify attribute
yamarkz Apr 24, 2020
bfc4d8e
update package version
yamarkz Apr 24, 2020
f0cc548
modify CHANGELOG.md
yamarkz Apr 25, 2020
6deb8cf
add EOF line
yamarkz Apr 25, 2020
4cf79ac
modify conflict
yamarkz Apr 30, 2020
a373bf7
use v2 embedding context
yamarkz Apr 30, 2020
e48ff2c
modify conflict file
yamarkz May 18, 2020
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
4 changes: 4 additions & 0 deletions packages/google_sign_in/google_sign_in/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.5.0

* Add support for getting `serverAuthCode`.

## 4.4.6

* Update lower bound of dart dependency to 2.1.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ public void init(
.getIdentifier("default_web_client_id", "string", context.getPackageName());
if (clientIdIdentifier != 0) {
optionsBuilder.requestIdToken(context.getString(clientIdIdentifier));
optionsBuilder.requestServerAuthCode(context.getString(clientIdIdentifier));
}
for (String scope : requestedScopes) {
optionsBuilder.requestScopes(new Scope(scope));
Expand Down Expand Up @@ -484,6 +485,7 @@ private void onSignInAccount(GoogleSignInAccount account) {
response.put("email", account.getEmail());
response.put("id", account.getId());
response.put("idToken", account.getIdToken());
response.put("serverAuthCode", account.getServerAuthCode());
response.put("displayName", account.getDisplayName());
if (account.getPhotoUrl() != null) {
response.put("photoUrl", account.getPhotoUrl().toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_web_client_id">YOUR_WEB_CLIENT_ID</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
<string>1:479882132969:ios:2643f950e0a0da08</string>
<key>DATABASE_URL</key>
<string>https://my-flutter-proj.firebaseio.com</string>
<key>SERVER_CLIENT_ID</key>
<string>YOUR_SERVER_CLIENT_ID</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// for more info.
static NSString *const kClientIdKey = @"CLIENT_ID";

static NSString *const kServerClientIdKey = @"SERVER_CLIENT_ID";

// These error codes must match with ones declared on Android and Dart sides.
static NSString *const kErrorReasonSignInRequired = @"sign_in_required";
static NSString *const kErrorReasonSignInCanceled = @"sign_in_canceled";
Expand Down Expand Up @@ -76,6 +78,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
if (path) {
NSMutableDictionary *plist = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
[GIDSignIn sharedInstance].clientID = plist[kClientIdKey];
[GIDSignIn sharedInstance].serverClientID = plist[kServerClientIdKey];
[GIDSignIn sharedInstance].scopes = call.arguments[@"scopes"];
[GIDSignIn sharedInstance].hostedDomain = call.arguments[@"hostedDomain"];
result(nil);
Expand Down Expand Up @@ -221,6 +224,7 @@ - (void)signIn:(GIDSignIn *)signIn
@"email" : user.profile.email ?: [NSNull null],
@"id" : user.userID ?: [NSNull null],
@"photoUrl" : [photoUrl absoluteString] ?: [NSNull null],
@"serverAuthCode" : user.serverAuthCode ?: [NSNull null]
}
error:nil];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class GoogleSignInAuthentication {
/// The OAuth2 access token to access Google services.
String get accessToken => _data.accessToken;

/// Server auth code used to access Google Login
String get serverAuthCode => _data.serverAuthCode;

@override
String toString() => 'GoogleSignInAuthentication:$_data';
}
Expand Down
4 changes: 2 additions & 2 deletions packages/google_sign_in/google_sign_in/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_sign_in
description: Flutter plugin for Google Sign-In, a secure authentication system
for signing in with a Google account on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in
version: 4.4.6
version: 4.5.0

flutter:
plugin:
Expand All @@ -16,7 +16,7 @@ flutter:
default_package: google_sign_in_web

dependencies:
google_sign_in_platform_interface: ^1.1.0
google_sign_in_platform_interface: ^1.1.1
flutter:
sdk: flutter
meta: ^1.0.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void main() {
'getTokens': <dynamic, dynamic>{
'idToken': '123',
'accessToken': '456',
'serverAuthCode': '789',
},
};

Expand Down Expand Up @@ -370,6 +371,7 @@ void main() {

expect(auth.accessToken, '456');
expect(auth.idToken, '123');
expect(auth.serverAuthCode, '789');
expect(
log,
<Matcher>[
Expand Down