Google Login problem with standalone app

I try to do it by read the expo document and get this result


But when I press to choose account and dialog is disappeared and then… nothing , no error no result just get back to login page. Anyone know what happened?

Can you post your code? It’s hard to know what’s going on otherwise.
The best is if you can link to your complete project on Github or something like that.

Here is my Google login part

 static gglogin = async () => {
    const loginResult = await Expo.Google.logInAsync({
          androidClientId: 'My android ClientId',
          androidStandaloneAppClientId: 'My android standalone ClientId',
          iosClientId: 'My IOS ClientId',
          scopes: ['profile', 'email'],
    });
    if(loginResult.type === 'success'){
      console.log(loginResult.user.name + " : " + loginResult.user.id + " : " + loginResult.user.email)
      const provider = firebase.auth.GoogleAuthProvider
      const credential = provider.credential(null, loginResult.accessToken)
      Actions.course();
      return firebase.auth().signInWithCredential(credential)
    }else {
      Alert.alert("Login Error");
    }
  };

and this is my app.json

 {
  "expo": {
    "name": "ggLoginTest",
    "icon": "./src/img/logo2.png",
    "version": "1.0.0",
    "slug": "gglogintest",
    "sdkVersion": "17.0.0",
    "android": {
      "package": "com.noernova.ggLoginTest",
      "config": {
        "googleSignIn": {
          "apiKey" : "My apiKey",
          "certificateHash": "My cert"
        }
      }
    }
  }
 }

I create all clientId, apiKey and certificateHash by suggestion from https://docs.expo.io/versions/v17.0.0/index.html and also try with https://docs.expo.io/versions/v19.0.0/index.html

But it’s work while run in expo client

Finally my app can run pretty well now by add behavior: ‘web’ in my login code.
Thank :wink:

5 Likes

Had exactly the same problem, and changing to “web” kind of solved it. Any ideas how to get the native login to work?

@ilkkavesa are you seeing an error similar to https://github.com/expo/expo/issues/416 ?

No, it was the same problem and same fix as @noernova described above. Expo 20 version, Android standalone app. After adding “web” started working.

Sorry didn’t have now time to dig for more detailed error codes etc, but seems that it stopped in code inside Google.logInAsync(…) as after that didn’t get any logs or such.

Same here. behavior: system doesn’t work with Expo 20 version, Android standalone app. Nothing happens after choosing an account from the system dialog.

I agree, the login does not work on Expo 20+, with the behaviour as “system” (or even not defining it because docs, says it will be “system” on stand-alone-app).

The same with google maps. It works on expo client, but does not on stand alone. I have read the documents, several times. I was able to make it work on my previous app exp version 18, but not now. I’m not sure why

1 Like

Can confirm - standalone Google login doesn’t work (at least on Android) on SDK20, but that behavior=‘web’ fixed it.

I’ve spent many hours debugging my Firebase/Google setup, because ADB LogCat output the following:

Auth    : [GetToken] GetToken failed with status code: INVALID_AUDIENCE
TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE

I’ll try the SDK21 when I have time to test and change the camera integration due to the breaking API change.

The SDK21 seems to have broken more than it fixed on first try. I’ll have to investigate further, but not only did it not help with google native signin, it also broke Facebook which works on SDK20.

here is an example of FB Login on SDK 21:
https://snack.expo.io/@ccheever/facebook-login-example-sdk21

example of google login on SDK 21:
https://snack.expo.io/@ccheever/google-login-example-for-sdk-21

I believe that on Android, you also need to provide a webClientId option to the Google.logInAsync method.

1 Like

Hey folks - I also came across this issue.

I ran adb logcat with my device plugged into my computer and was able to see the error logs on the standalone app. I got a message that looked something like this:

  E/Google Maps Android API( 4889): Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
  E/Google Maps Android API( 4889): In the Google Developer Console (https://console.developers.google.com)
  E/Google Maps Android API( 4889): Ensure that the "Google Maps Android API v2" is enabled.
  E/Google Maps Android API( 4889): Ensure that the following Android Key exists:
  E/Google Maps Android API( 4889): 	API Key: myApiKey
  E/Google Maps Android API( 4889): 	Android Application (<cert_fingerprint>;<package_name>): MY:SH:A1:HA:SH:CE:RT;com.something.myapp

The API key and Bundle Identifier matched what I had in the Google Console, but the SHA-1 Fingerprint / Certificate Hash was different. I changed the Fingerprint on Google Console to the value I saw in the console, and that did the trick.

I was originally getting the Fingerprint with a function like this:
keytool -list -printcert -jarfile growler.apk | grep SHA1 | awk '{ print $2 }'
Per the guidance here, but it seems to produce something different than what I am seeing in adb logcat. I am not exactly sure what’s going on here, but I believe this is where some others like myself are getting caught up.

Edit: To give more clarity, I realize I only spoke to Google Maps. I was also having an issue with the Google Login, and it was also remedied by changing the certificateHash/fingerprint in my app.json and Google Cloud Console.

1 Like

Same issue here,
has been any advance on it?
@pcooney10 in my Google Login process I cannot see similar traces to those you are posting, I don’t know from where to get the proper certificateHash, if this is the issue.

I am getting and accessToken and a idToken from Google but just calling firebase.auth.GoogleAuthProvider.credential makes the whole app crash and go back to Login screen.

Thanks,

Referring to https://github.com/expo/expo/issues/1429

Need to add both androidStandaloneAppClientId AND webClientId when calling Expo.Google.logInAsync in Android Standalone App

@noernova Is google login working now for you. I tried but after getting an email it redirects to google home page instead of returning access token and other details

I have the similar problem. I am using SDK 34 now. I used Google expo as sign-in method. Its works fine for me in development in expo client app. But after I build the app, it doesn’t show anything. I want to know how you fixed the issues. Is there someone help me for this?

Even I have the same issue.