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

[google_sign_in_platform_interface] Add support for serverClientId #5256

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,7 @@
## 2.2.0

* Adds support for the `serverClientId` parameter.

## 2.1.3

* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MethodChannelGoogleSignIn extends GoogleSignInPlatform {
'scopes': params.scopes,
'hostedDomain': params.hostedDomain,
'clientId': params.clientId,
'serverClientId': params.serverClientId,
'forceCodeForRefreshToken': params.forceCodeForRefreshToken,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SignInInitParameters {
this.signInOption = SignInOption.standard,
this.hostedDomain,
this.clientId,
this.serverClientId,
this.forceCodeForRefreshToken = false,
});

Expand All @@ -49,9 +50,30 @@ class SignInInitParameters {
/// By default, the list of accounts will not be restricted.
final String? hostedDomain;

/// The client ID to use when signing in.
/// The OAuth client ID of the app.
///
/// The default is null, which means that the client ID will be sourced from a
/// configuration file, if required on the current platform. A value specified
/// here takes precedence over a value specified in a configuration file.
Copy link
Contributor

Choose a reason for hiding this comment

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

nits: Could you add a link to how to set the values with configuration file? Something like:

/// See also: 
/// 
/// [Platform Integration](https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in#platform-integration), where you can find the details about the configuration files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/// See also:
///
/// * [Platform Integration](https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in#platform-integration),
/// where you can find the details about the configuration files.
final String? clientId;

/// The OAuth client ID of the backend server.
///
/// The default is null, which means that the server client ID will be sourced
/// from a configuration file, if available and supported on the current
/// platform. A value specified here takes precedence over a value specified
/// in a configuration file.
///
/// See also:
///
/// * [Platform Integration](https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in#platform-integration),
/// where you can find the details about the configuration files.
final String? serverClientId;

/// If true, ensures the authorization code can be exchanged for an access
/// token.
///
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/main/packages/google_sign_in
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.1.3
version: 2.2.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void main() {
'scopes': <String>['two', 'scopes'],
'signInOption': 'SignInOption.games',
'clientId': 'fakeClientId',
'serverClientId': null,
'forceCodeForRefreshToken': false,
}),
() {
Expand Down Expand Up @@ -144,13 +145,15 @@ void main() {
scopes: <String>['two', 'scopes'],
signInOption: SignInOption.games,
clientId: 'fakeClientId',
serverClientId: 'fakeServerClientId',
forceCodeForRefreshToken: true));
expect(log, <Matcher>[
isMethodCall('init', arguments: <String, dynamic>{
'hostedDomain': 'example.com',
'scopes': <String>['two', 'scopes'],
'signInOption': 'SignInOption.games',
'clientId': 'fakeClientId',
'serverClientId': 'fakeServerClientId',
'forceCodeForRefreshToken': true,
}),
]);
Expand Down