In our flutter project, we are using google login for domain specific google login.
When user is trying our app & adding new google accounts on Android its always returning null for only first time.
Following are the steps to reproduce:
- User click on the google login button in our app on his Android device.
- On google popup user click on the "Add another account" option.
- Android opens up its default add account wizard.
- After complete account setup it asks for screenlock, only if its not already enabled on device.
- After this the account setup is complete & user comes back on our app.
- Here our code suppose to get the user object which is coming null.
- If user clicks on login button again & select the account. Then we are getting the user object without any issue.
Following is our sample login code:
GoogleSignIn _googleSignIn = GoogleSignIn(
clientId:
'our_client_id',
serverClientId:
"our_server_id",
hostedDomain: "[email protected]",
);
final GoogleSignInAccount? gUser = await _googleSignIn.signIn();
// This gUser is always null on adding new account
What have we tried so far
- Using normal google account can return user object even on first try
- Tested "google_sign_in" version 6.1.5 to 6.2.1
- After login its always returning user object as null
- If screen lock is already enabled on device its still returning null on adding new account
- Even after adding new account directly from settings the first try from app returns null
Some technical aspects of our code
- We can't use normal google, only user with specific domain can access the application
- We have enforced screen lock policy on our domain
- This issue is only coming in Android devices & emulators. iOS is working fine.