Google native login fails on standalone apps

Hello all,

I’m having issues with the ‘system’ Google login. Facebook, email and the ‘web’ variant of Google works just fine. I’ve had issues since I implemented it in SDK 20, but stopped working on it after I found out from another issue that there were some bugs in the Google native signin module that should have been resolved with the updates in SDK 21/22, but alas - it still doesn’t work for me.

After some debugging I’ve found out that my issue is that the resulting object only contains the following objects:

user, idToken, serverAuthCode, type and a refreshToken:null

Thus, I’m missing an accessToken, as well as a non-null refresh token. I noticed that the Expo docs on the return object have recently added the following:

Please note that to have access to accessToken, idToken and refreshToken you need to pass webClientId for standalone apps.

“Yay!” I thought, and quickly added a webClientId to my google creds and tried it out, but it didn’t work. I even added another one with absolutely no restrictions to calling URLs, but it didn’t help.

My code looks as follows, almost copy+pasted from the guide:

      const result = await Google.logInAsync({
        androidClientId: GOOGLE_ANDROID_CLIENT_ID,
        iosClientId: GOOGLE_IOS_CLIENT_ID,
        androidStandaloneAppClientId: GOOGLE_ANDROID_STANDALONE_CLIENT_ID,
        iosStandaloneAppClientId: GOOGLE_IOS_STANDALONE_CLIENT_ID,
        webClientId: GOOGLE_WEB_CLIENT_ID,
        scopes: ['profile', 'email'],
      });

I have an iOS (restricted to bundle name) and Android (restricted to package name and SHA1 fingerprints of both my upload keystore, the Google Play store app signing keystore, as well as my local Android debug keystore) API keys:

image

These are registered in my app.json as follows:

 "ios": {
      ...
      "bundleIdentifier": "my.identifier.ios",
      "config": {
        "googleMapsApiKey": "MY_API_KEY_FOR_IOS",
        "googleSignIn": {
          "reservedClientId":
            "com.googleusercontent.apps.THE_ID"
        }
      }
    },
    "android": {
      ...
      "package": "my.identifier.android",
      "config": {
        "googleSignIn": {
          "apiKey": "MY_API_KEY_FOR_ANDROID",

I also have the client IDs, which are used in the code above as well as app.json:
image

I’m using the android client for upload cert (and re-verified the SHA1 fingerprint on the Expo-built standalone Android app) , the iOS key where I’ve only specified the bundle and not the optional appstore IDs, and the web client 2 where there are no restrictions on:

image

I’m running out of ideas. Do I need to specify restrictions on the web key? And if so, which?

I hope I’ve covered all info necessary to spot my mistake, otherwise please let me know :slight_smile:

1 Like

Hey @jhalborg, I was also struggling to get this to work but think I may have figured out a solution.

I provide more detail here & here, but in short I think the issue has to do with the SHA1 fingerprint. I was observing a different value when I plugged an android into my computer and ran adb logcat, so this could be the same issue for you.