-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to Reproduce
- Create an app which uses
google_sign_inplugin - Run it on a device, sign in with Google
- Stop the app
- Turn on airplane mode
- 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>.