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

Commit 5117a3f

Browse files
authored
[google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface user data (#4179)
1 parent 174f140 commit 5117a3f

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.0
2+
3+
* Add serverAuthCode attribute to user data
4+
15
## 2.0.1
26

37
* Updates `init` function in `MethodChannelGoogleSignIn` to parametrize `clientId` property.

packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GoogleSignInUserData {
3131
this.displayName,
3232
this.photoUrl,
3333
this.idToken,
34+
this.serverAuthCode,
3435
});
3536

3637
/// The display name of the signed in user.
@@ -66,9 +67,12 @@ class GoogleSignInUserData {
6667
/// data.
6768
String? idToken;
6869

70+
/// Server auth code used to access Google Login
71+
String? serverAuthCode;
72+
6973
@override
70-
int get hashCode =>
71-
hashObjects(<String?>[displayName, email, id, photoUrl, idToken]);
74+
int get hashCode => hashObjects(
75+
<String?>[displayName, email, id, photoUrl, idToken, serverAuthCode]);
7276

7377
@override
7478
bool operator ==(dynamic other) {
@@ -79,7 +83,8 @@ class GoogleSignInUserData {
7983
otherUserData.email == email &&
8084
otherUserData.id == id &&
8185
otherUserData.photoUrl == photoUrl &&
82-
otherUserData.idToken == idToken;
86+
otherUserData.idToken == idToken &&
87+
otherUserData.serverAuthCode == serverAuthCode;
8388
}
8489
}
8590

packages/google_sign_in/google_sign_in_platform_interface/lib/src/utils.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ GoogleSignInUserData? getUserDataFromMap(Map<String, dynamic>? data) {
1414
id: data['id']!,
1515
displayName: data['displayName'],
1616
photoUrl: data['photoUrl'],
17-
idToken: data['idToken']);
17+
idToken: data['idToken'],
18+
serverAuthCode: data['serverAuthCode']);
1819
}
1920

2021
/// Converts token data coming from native code into the proper platform interface type.

packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/google_sign_
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.0.1
7+
version: 2.1.0
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"

packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const Map<String, String> kUserData = <String, String>{
1313
"id": "8162538176523816253123",
1414
"photoUrl": "https://lh5.googleusercontent.com/photo.jpg",
1515
"displayName": "John Doe",
16+
'idToken': '123',
17+
'serverAuthCode': '789',
1618
};
1719

1820
const Map<dynamic, dynamic> kTokenData = <String, dynamic>{

0 commit comments

Comments
 (0)