Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authenticate with google doesn't redirect back to app #53

Closed
ozanturksever opened this issue Feb 5, 2017 · 21 comments
Closed

Authenticate with google doesn't redirect back to app #53

ozanturksever opened this issue Feb 5, 2017 · 21 comments

Comments

@ozanturksever
Copy link

ozanturksever commented Feb 5, 2017

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 }));
@terribleben
Copy link
Contributor

@brentvatne or @janicduplessis might have more thoughts about this.

@janicduplessis
Copy link
Contributor

What android version are you using?

@ozanturksever
Copy link
Author

i am testing on 6.0.1

rlugojr pushed a commit to rlugojr/exponent that referenced this issue Feb 24, 2017
expo#53)

* [sdk] Lazy imports for exponent-sdk.

* [android] QR code support.

fbshipit-source-id: 04bb1ce
@brentvatne
Copy link
Member

@janicduplessis - what's the status of this? I believe I recall seeing a fix a couple weeks ago

@janicduplessis
Copy link
Contributor

Yes, we introduced a bug in sdk 14, it should be fixed now.

@ozanturksever
Copy link
Author

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

@omerdn1
Copy link
Contributor

omerdn1 commented Mar 3, 2017

@janicduplessis I can confirm It's not fixed, running sdk 14.

@janicduplessis
Copy link
Contributor

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.

@ozanturksever
Copy link
Author

yes, i am on a real device.

@omerdn1
Copy link
Contributor

omerdn1 commented Mar 11, 2017

@janicduplessis Works prefectly fine on a real device, thank you for clarifying.

@terribleben
Copy link
Contributor

It sounds like this was an issue with device vs. emulator and is resolved - let me know if this should still be open.

@pandananta
Copy link

I'm experiencing this same issue on sdk 28, using a real device (Google Pixel)

@Nahani
Copy link

Nahani commented Dec 15, 2018

I have the same issue on sdk 31, using real device. After loggin we are not redirect to the app but to the web page google.com

@opringle
Copy link

opringle commented Feb 3, 2019

Also experiencing this issue with a real google pixel 3.

@gauravsaluja2006
Copy link

I'm experiencing this same issue on sdk 32 on a OnePlus5.
Although the same code is working on iPhone.

@MonasteryJohn
Copy link

MonasteryJohn commented Feb 9, 2019

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.

@QuintonC
Copy link

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

This worked for me as well. Huge thank you (and good find) @MonasteryJohn.

@jitenderchand1
Copy link

facing the same issue. I have my package name in all lower case

@QuintonC
Copy link

facing the same issue. I have my package name in all lower case

Which sdk? Are you detached?

@jitenderchand1
Copy link

jitenderchand1 commented Jul 10, 2019

not detached from expo. This is happing on real android device. This is working fine with ios simulator
expo verion is 2.21.2

const result = await Google.logInAsync({
      behavior: 'web',
      androidStandaloneAppClientId:
        '131814552849-iwyqerbsbadf78623gjsfd.apps.googleusercontent.com',
      iosClientId:
        '131814552849-asdfsakwero9879sdhjkfs.apps.googleusercontent.com',
      scopes: ['profile', 'email']
    });
    "expo-asset": "^5.0.1",
    "expo-blur": "^5.0.1",
    "expo-linear-gradient": "^5.0.1",
    "firebase": "^6.2.4",
    "prop-types": "^15.7.2",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "^0.59.9",
    "react-native-animatable": "^1.3.2",
    "react-native-confirmation-code-input": "^1.0.4",
    "react-native-elements": "^1.1.0",
    "react-native-material-textfield": "^0.12.0",
    "react-native-web": "^0.11.4",
    "react-navigation": "^3.11.0",
    "react-redux": "^7.1.0",
    "redux": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"```

@jitenderchand1
Copy link

following code is working fine with android emulator.

const result = await Google.logInAsync({
      behavior: 'web',
      androidClientId:
        '131814552849-lkahdfiowyerioyowjasd.apps.googleusercontent.com',
      iosClientId:
        '131814552849-asdfkheioryuowsdknk.apps.googleusercontent.com',
      scopes: ['profile', 'email']
    });

While created a clientId I used host.exp.exponent as a packge name. But while creaed a standalone build by running expo build:android my app.json file has different packge name.

@lock lock bot added the outdated label Jan 6, 2020
@lock lock bot locked and limited conversation to collaborators Jan 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests