google_sign_in always returning null when adding new google account from app on android

46 views Asked by At

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:

  1. User click on the google login button in our app on his Android device.
  2. On google popup user click on the "Add another account" option.
  3. Android opens up its default add account wizard.
  4. After complete account setup it asks for screenlock, only if its not already enabled on device.
  5. After this the account setup is complete & user comes back on our app.
  6. Here our code suppose to get the user object which is coming null.
  7. 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

  1. Using normal google account can return user object even on first try
  2. Tested "google_sign_in" version 6.1.5 to 6.2.1
  3. After login its always returning user object as null
  4. If screen lock is already enabled on device its still returning null on adding new account
  5. Even after adding new account directly from settings the first try from app returns null

Some technical aspects of our code

  1. We can't use normal google, only user with specific domain can access the application
  2. We have enforced screen lock policy on our domain
  3. This issue is only coming in Android devices & emulators. iOS is working fine.
0

There are 0 answers