expo: Authenticate with google doesn't redirect back to app

Authenticate with google(on Android) redirects to google.com not to app itself.
Can be reproduced with exp.host@notbrent/native-component-list google auth button.

url redirected: https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=host.exp.exponent%3A%2Foauthredirect&client_id=733666839474-29hiep386cbm9u262lvgjf96uvq8pglu.apps.googleusercontent.com&response_type=code&state=hZ3f26YcYdrzfQLpvWRm7w&scope=profile%20email&code_challenge=5xHtVcrqLe_hCKOnj_rLYgjSRZut98C8O3ATsMfS8j8&code_challenge_method=S256

Exponent.Google.logInAsync({
    behavior: 'web',
    androidClientId: '733666839474-29hiep386cbm9u262lvgjf96uvq8pglu.apps.googleusercontent.com',
    iosClientId: '733666839474-l0s6c0d1m4f844cin668iilgears8b2n.apps.googleusercontent.com',
    androidStandaloneAppClientId: '733666839474-g2i9bjpet38je9159v6aq2s822pk2rop.apps.googleusercontent.com',
    iosStandaloneAppClientId: '1052406890180-eo50cdr1fnqu0kgpg3rh8hvchb49vf98.apps.googleusercontent.com',
    scopes: ['profile', 'email'],
  })
  .then((result) => {
    if (result.type === 'success') {
      return path.success({ accessToken: result });
    }
    return path.failed({ accessToken: err });
  })
  .catch(err => path.failed({ accessToken: err }));

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Not sure if this will help anyone else, but I found that I would run into this problem on a real device if my android package name had a mix of upper and lower case letters.

For example, com.company.AppName would cause the redirect to google.com, whereas com.company.appname would be perfectly happy.

In my case it made no difference whether the Google oAuth credential was set to the same upper case version or not, it just didn’t work that way at all.’

@terribleben Is there any other solution to this problem? Still experiencing with sdk 32 on S9.

Are you testing on a real device or the simulator? Also what browser is installed on it? I’m asking because on the Android simulator the installed browser is usually WebviewBrowser and it doesn’t support app scheme redirects.

it doesn’t look fixed. I tried again and redirected to google.