Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[gsi_web] Enable FedCM where available.
  • Loading branch information
ditman committed Nov 1, 2023
commit 2914d71a08b2c32c4be4b01f2f4e3e017bddea45
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class GisSdkClient {
_initializeIdClient(
clientId,
onResponse: _onCredentialResponse,
hostedDomain: hostedDomain,
useFedCM: true,
);

_tokenClient = _initializeTokenClient(
Expand Down Expand Up @@ -102,13 +104,18 @@ class GisSdkClient {
void _initializeIdClient(
String clientId, {
required CallbackFn onResponse,
String? hostedDomain,
bool? useFedCM,
}) {
// Initialize `id` for the silent-sign in code.
final IdConfiguration idConfig = IdConfiguration(
client_id: clientId,
callback: allowInterop(onResponse),
cancel_on_tap_outside: false,
auto_select: true, // Attempt to sign-in silently.
hd: hostedDomain,
use_fedcm_for_prompt:
useFedCM, // Use the native browser prompt, when available.
);
id.initialize(idConfig);
}
Expand Down Expand Up @@ -238,7 +245,15 @@ class GisSdkClient {
/// * If [_lastCredentialResponse] is null, we add [people.scopes] to the
/// [_initialScopes], so we can retrieve User Profile information back
/// from the People API (without idToken). See [people.requestUserData].
@Deprecated(
'Use `renderButton` instead. See: https://pub.dev/packages/google_sign_in_web#migrating-to-v011-and-v012-google-identity-services')
Future<GoogleSignInUserData?> signIn() async {
// Warn users that this method will be removed.
domConsole.warn(
'The google_sign_in plugin `signIn` method is deprecated on the web, and will be removed in Q2 2024. Please use `renderButton` instead. See: ',
<String>[
'https://pub.dev/packages/google_sign_in_web#migrating-to-v011-and-v012-google-identity-services'
]);
// If we already know the user, use their `email` as a `hint`, so they don't
// have to pick their user again in the Authorization popup.
final GoogleSignInUserData? knownUser =
Expand Down
2 changes: 1 addition & 1 deletion packages/google_sign_in/google_sign_in_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
google_identity_services_web: ^0.2.1
google_identity_services_web: ^0.2.2
google_sign_in_platform_interface: ^2.4.0
http: ">=0.13.0 <2.0.0"
js: ^0.6.3
Expand Down