Can't refresh idToken after expiration for a google sign in

284

The issue was the test virual device had a wrong date & time set ..

Share:
284
Gabriel Luca
Author by

Gabriel Luca

Updated on December 12, 2022

Comments

  • Gabriel Luca
    Gabriel Luca over 1 year

    I use flutter google_sign_in package to implement google login in my app and it dose work but after 1h the idToken expires and I can't refresh it even if I call signInSilently() can anyone help ?

    Thanks!

    Future<bool> signInGoogle(BuildContext context) async {
        setState(ViewState.Busy);
        try {
          var u = await _googleSignIn.signInSilently();
          if (u==null) u = await _googleSignIn.signIn();
          // Authenticate the GoogleUser
          // This will give back an access token and id token
          GoogleSignInAuthentication googleAuth = await u.authentication;
          await _api.loginExternalG(googleAuth.idToken);
        } catch (e) {
          return false;
        }
        setState(ViewState.Idle);
        return true;
      }