Skip to content

Commit

Permalink
[google_sign_in] Add serverAuthCode attribute to google_sign_in_platf…
Browse files Browse the repository at this point in the history
…orm_interface user data (flutter#4179)
  • Loading branch information
p-shapovalov authored Oct 8, 2021
1 parent 174f140 commit 5117a3f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.0

* Add serverAuthCode attribute to user data

## 2.0.1

* Updates `init` function in `MethodChannelGoogleSignIn` to parametrize `clientId` property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GoogleSignInUserData {
this.displayName,
this.photoUrl,
this.idToken,
this.serverAuthCode,
});

/// The display name of the signed in user.
Expand Down Expand Up @@ -66,9 +67,12 @@ class GoogleSignInUserData {
/// data.
String? idToken;

/// Server auth code used to access Google Login
String? serverAuthCode;

@override
int get hashCode =>
hashObjects(<String?>[displayName, email, id, photoUrl, idToken]);
int get hashCode => hashObjects(
<String?>[displayName, email, id, photoUrl, idToken, serverAuthCode]);

@override
bool operator ==(dynamic other) {
Expand All @@ -79,7 +83,8 @@ class GoogleSignInUserData {
otherUserData.email == email &&
otherUserData.id == id &&
otherUserData.photoUrl == photoUrl &&
otherUserData.idToken == idToken;
otherUserData.idToken == idToken &&
otherUserData.serverAuthCode == serverAuthCode;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ GoogleSignInUserData? getUserDataFromMap(Map<String, dynamic>? data) {
id: data['id']!,
displayName: data['displayName'],
photoUrl: data['photoUrl'],
idToken: data['idToken']);
idToken: data['idToken'],
serverAuthCode: data['serverAuthCode']);
}

/// Converts token data coming from native code into the proper platform interface type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/google_sign_
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
# 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: 2.0.1
version: 2.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const Map<String, String> kUserData = <String, String>{
"id": "8162538176523816253123",
"photoUrl": "https://lh5.googleusercontent.com/photo.jpg",
"displayName": "John Doe",
'idToken': '123',
'serverAuthCode': '789',
};

const Map<dynamic, dynamic> kTokenData = <String, dynamic>{
Expand Down

0 comments on commit 5117a3f

Please sign in to comment.