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

Google authentication not working with Expo SDK 48 #21944

Closed
Rashed94x opened this issue Apr 2, 2023 · 20 comments
Closed

Google authentication not working with Expo SDK 48 #21944

Rashed94x opened this issue Apr 2, 2023 · 20 comments

Comments

@Rashed94x
Copy link

Minimal reproducible example

https://github.com/Rashed94x/expo48-google-auth

Summary

Expected behavior

When the user clicks on the sign-in button, a pop-up web browser should open, allowing the user to select a Google account to use for logging in to the Expo app. The user should then be redirected back to the app and authenticated with their selected Google account.

Actual behavior

After upgrading to Expo SDK 48 and attempting to sign in with Google, a web browser opens with the error message "ValidationError: 'client_id' is not allowed. 'response_type' is not allowed. 'state' is not allowed. 'scope' is not allowed." The user is not able to select a Google account and authenticate with the app.

Affected platforms

This issue affects iOS devices when using Expo SDK 48.

Environment

expo-env-info 1.0.5 environment info:
System:
OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
npmPackages:
expo: ~48.0.9 => 48.0.9
react: 18.2.0 => 18.2.0
react-native: 0.71.4 => 0.71.4
Expo Workflow: managed

@Rashed94x Rashed94x added the needs validation Issue needs to be validated label Apr 2, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Apr 2, 2023
@truongtv22
Copy link

Same issue =((

@RaymondMoay
Copy link

Same issue. Using Firebase JS SDK.

@rsoaresdev
Copy link

Same issue. 😔

@timsmith339
Copy link

timsmith339 commented Apr 9, 2023

Has anybody found a possible fix or workaround?

@masterRokshi
Copy link

Hey,

I have similar issue - have managed to get it working using expo-dev-client.

I didn't find a way to fix this for Expo Go - not sure if there is one currently. It seems like using Oauth google login on IOS, currently requires building the app.

Once you configure the build, you can use

import { makeRedirectUri } from 'expo-auth-session';

to get the correct redirect URL.

const [request, response, promptAsync] = Google.useAuthRequest({
 clientId: 'xxxx',
 iosClientId:
        'xxxx',
 redirectUri: makeRedirectUri()});

Also remember to generate IOS credentials in the google console.

@RaymondMoay
Copy link

Works after a rebuild. Thanks!

@brentvatne brentvatne added Issue accepted docs AuthSession and removed needs review Issue is ready to be reviewed by a maintainer labels Apr 12, 2023
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@alexwert10
Copy link

Has anyone been able to get this working for a preview build? Your comments helped me get the development build working with Google Auth through firebase, but when I switch to a preview build II get the following error: "Access blocked: This app's request is invalid. You can't sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Error 400: redirect_uri_mismatch".

@JDoveBizDev
Copy link

Ya same issue. Would rather not use firebase auth because we're using mongo db. Getting the validation error on iOS

@karimcambridge
Copy link

karimcambridge commented May 9, 2023

It appears that expo is slowly forcing everybody to use dev clients.

add useProxy: true in useAuthRequest, it will give you a deprecation warning but it will work in expo go.

for expo-dev-client, use makeRedirect with your app scheme, follow the instructions in the docs.

@Fszgn
Copy link

Fszgn commented May 29, 2023

I have also the same issue here.

@amandeepmittal
Copy link
Member

amandeepmittal commented May 30, 2023

@Rashed94x, (going through the minimal reproducible example link) Instead of expoClientId, please use androidClientId and iosClientId for native platforms. We do mention that in docs: https://docs.expo.dev/guides/google-authentication/#get-credentials. Also, when getting Client IDs from Google Cloud, make sure you are generating separate ids for native platforms and selecting native application type (instead of Web which was the case previously when using Expo Go but with development builds, you have to select the native application type).

@Rashed94x
Copy link
Author

@Rashed94x, (going through the minimal reproducible example link) Instead of expoClientId, please use androidClientId and iosClientId for native platforms. We do mention that in docs: https://docs.expo.dev/guides/google-authentication/#get-credentials. Also, when getting Client IDs from Google Cloud, make sure you are generating separate ids for native platforms and selecting native application type (instead of Web which was the case previously when using Expo Go but with development builds, you have to select the native application type).

Hey @amandeepmittal
To workaround this problem in the project i was working on (which was a school project) i just downgraded to EXPO SDK 47.
However, your response has prompted a new question for me.

Are you suggesting that to use the AuthSession API with iOS on Expo SDK 48, it's necessary to utilize development builds? If that's the case, does that means that i have to work on a macOS i order to run an ios simulator to run the development build?

in other words, is it necessary to use macOS to (develop and test) AuthSession API with ios?

@amandeepmittal
Copy link
Member

amandeepmittal commented Jun 2, 2023

@Rashed94x, yes. We deprecated authProxy from SDK 48 (more info in this blog post as to why) and moving forward, we recommend creating development builds because androidClientId and iosClientId are both native client IDs whereas expoClientId used to be a Proxy that was meant to be used for testing purposes.

You can use EAS to create a development build on the cloud and use an iOS device to test it or if you have access to macOS with Xcode installed, you can create development builds locally and use iOS simulator for testing.

@amandeepmittal
Copy link
Member

We've deprecated Google auth provider from expo-auth-session starting SDK 49. We recommend using a native library such as @react-native-google-signin/google-signin. We don't maintain the native library, however, we did write a short guide on what steps might be required to configure an Expo project: https://docs.expo.dev/guides/google-authentication/. The same library can also be used with previous SDK versions.

@ansh
Copy link

ansh commented Sep 19, 2023

@amandeepmittal If I want to implement Google sign in on an Expo Go application, is it no longer possible?

@amandeepmittal
Copy link
Member

@ansh, with SDK 49, it is not. You'll have to create a development build and use a library like https://github.com/react-native-google-signin/google-signin since it modifies custom native code via a config plugin.

@ansh
Copy link

ansh commented Sep 19, 2023

@amandeepmittal That is unfortunate! The package you linked to requires payment for most new functionality and even bug fixes.

@magnum6actual
Copy link

It seems like there is less and less of a reason to even use Expo going forward. Is the entire project being shut down?

@sonipranjal
Copy link
Contributor

This is really not a great thing, I spent almost a day trying to implement google oauth for react native, and here I see it is not possible with SDK 49, and this package https://github.com/react-native-google-signin/google-signin doesn't support supabase well, what options are left?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

17 participants