signIn method

  1. @override
Future<GoogleSignInUserData?> signIn()
override

Signs in the user with the options specified to init.

Implementation

@override
Future<GoogleSignInUserData?> signIn() async {
  if (kDebugMode) {
    web.console.warn(
        "The `signIn` method is discouraged on the web because it can't reliably provide an `idToken`.\n"
                'Use `signInSilently` and `renderButton` to authenticate your users instead.\n'
                'Read more: https://pub.dev/packages/google_sign_in_web'
            .toJS);
  }
  await initialized;

  // This method mainly does oauth2 authorization, which happens to also do
  // authentication if needed. However, the authentication information is not
  // returned anymore.
  //
  // This method will synthesize authentication information from the People API
  // if needed (or use the last identity seen from signInSilently).
  try {
    return _gisClient.signIn();
  } catch (reason) {
    throw PlatformException(
      code: reason.toString(),
      message: 'Exception raised from signIn',
      details:
          'https://developers.google.com/identity/oauth2/web/guides/error',
    );
  }
}