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

[google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface #2634

Merged
merged 4 commits into from
Apr 23, 2020
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ Nissim Dsilva <nissim@tengio.com>
Giancarlo Rocha <giancarloiff@gmail.com>
Ryo Miyake <ryo@miyake.id>
Théo Champion <contact.theochampion@gmail.com>
Kazuki Yamaguchi <y.kazuki0614n@gmail.com>
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.1

* Add attribute serverAuthCode.

## 1.1.0

* Add hasRequestedScope method to determine if an Oauth scope has been granted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,31 @@ class GoogleSignInUserData {
/// Holds authentication data after sign in.
class GoogleSignInTokenData {
/// Either or both parameters may be null.
GoogleSignInTokenData({this.idToken, this.accessToken});
GoogleSignInTokenData({
this.idToken,
this.accessToken,
this.serverAuthCode,
});

/// An OpenID Connect ID token for the authenticated user.
String idToken;

/// The OAuth2 access token used to access Google services.
String accessToken;

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

@override
int get hashCode => hash2(idToken, accessToken);
int get hashCode => hash3(idToken, accessToken, serverAuthCode);

@override
bool operator ==(dynamic other) {
if (identical(this, other)) return true;
if (other is! GoogleSignInTokenData) return false;
final GoogleSignInTokenData otherTokenData = other;
return otherTokenData.idToken == idToken &&
otherTokenData.accessToken == accessToken;
otherTokenData.accessToken == accessToken &&
otherTokenData.serverAuthCode == serverAuthCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ GoogleSignInTokenData getTokenDataFromMap(Map<String, dynamic> data) {
return GoogleSignInTokenData(
idToken: data['idToken'],
accessToken: data['accessToken'],
serverAuthCode: data['serverAuthCode'],
);
}
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.1.0
version: 1.1.1

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
import 'package:google_sign_in_platform_interface/src/types.dart';
import 'package:google_sign_in_platform_interface/src/utils.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

const Map<String, String> kUserData = <String, String>{
"email": "john.doe@gmail.com",
Expand All @@ -18,6 +18,7 @@ const Map<String, String> kUserData = <String, String>{
const Map<dynamic, dynamic> kTokenData = <String, dynamic>{
'idToken': '123',
'accessToken': '456',
'serverAuthCode': '789',
};

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