authentication property
Future<GoogleSignInAuthentication>
authentication
Retrieve GoogleSignInAuthentication
for this account.
shouldRecoverAuth
sets whether to attempt to recover authentication if
user action is needed. If an attempt to recover authentication fails a
PlatformException is thrown with possible error code
kFailedToRecoverAuthError.
Otherwise, if shouldRecoverAuth
is false and the authentication can be
recovered by user action a PlatformException is thrown with error code
kUserRecoverableAuthError.
Implementation
Future<GoogleSignInAuthentication> get authentication async {
if (_googleSignIn.currentUser != this) {
throw StateError('User is no longer signed in.');
}
final GoogleSignInTokenData response =
await GoogleSignInPlatform.instance.getTokens(
email: email,
shouldRecoverAuth: true,
);
// On Android, there isn't an API for refreshing the idToken, so re-use
// the one we obtained on login.
response.idToken ??= _idToken;
return GoogleSignInAuthentication._(response);
}