Skip to content

google_sign_in does not provide offline capabilities #15796

@pulyaevskiy

Description

@pulyaevskiy

Steps to Reproduce

  1. Create an app which uses google_sign_in plugin
  2. Run it on a device, sign in with Google
  3. Stop the app
  4. Turn on airplane mode
  5. Open the app, attempt to call signInSilently

Expected result: returns already signed in user account

Actual result: null

I'm using it in conjunction with firebase_auth plugin which does work when offline. However in my project I'm using other Google APIs which require accessToken and I can only get it from google_sign_in plugin, so I can't fully initialize authorized user when the app starts while offline.

Creating this issue for tracking purposes. I might be able to work on updating the plugin to support this in coming weeks.

Preliminary research tells that native SDKs provide a way to fetch current user.

On iOS can probably use currentUser property:
https://developers.google.com/identity/sign-in/ios/api/interface_g_i_d_sign_in.html#ac49bf5dabe7b89781cd58e69cb015651

On Android - most likely getLastSignInAccount:
https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignIn.html#getLastSignedInAccount(android.content.Context)

Though it'd probably be a breaking change as GoogleSignIn.currentUser is already used and it would have to be changed to return Future<GoogleSignInAccount>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.p: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions