Videos
» npm install expo-auth-session
What happened to seamless auth integrations with expo apps?
I'm using the expo-router and supabase. I want to implement google auth and I have two options:
expo-auth-session : the docs are not up to date, for implementing google auth with supabase the docs refer to the supabase docs which uses react-native-google-signin.
react-native-google-signin : the free/original version will be deprecated in 2025 so there's no point of using this and I do not want to use their paid version.
What should I do?
I had the same configuration as yours, a little bit different is in the
scheme value in app.json.
So this issue is regarding the deep linking mechanism that currently has no longer supported due to the risk of app impersonation.
To solve this what you need is enable scheme manually in your OAUTH credentials.
- Go to credentials page
- Select your current OAUTH credentials
- Open Advanced setting
- Check Enable custom URI scheme Enable scheme
For more details you can check reference here: https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_custom-scheme
could it be that you are logging in , on expo go, through a web browser as opposed to your app? and that google chrome or other trusted browsers are not installed in google play on your expo go? I tried installing google chrome first on my expo go then ran my app and it worked ok
Expo on their page wants us to use expo-auth-session over expo-google-app-auth.
But,
The expo-auth-session flow throws an ugly / scammy looking alert to the user before going into the google auth flow in an external browser, after showing a browser selection. Users are likely to drop off at this point itself, this is bad UX.
expo-google-app-auth doesn't do this, it seems to load what looks like a webiew inline and shows a clean google account selection screen.
However if you ignore this deprecation and continue using expo-google-app-auth, there is a runtime warning like "Deprecated: You will need to use expo-google-sign-in to do server side authentication outside of the Expo client" which I find confusing. Don't you have to do server side authentication (if you need to) regardless of which solution you use?
Thoughts around this? If you use the expo managed workflow, which one did you pick? I am at a bit of a dilemma...
Try this:
-Login to your expo account: on command line type:
expo login
##then your account credencials##
then restart your expo instance:
expo start
And everything should work fine
I have the exact same issue. I've posted on the Expo forums too and tried to contact the devs about it but nobody's responding to me. I think it's been broken with a recent change. If you look at the redirect URL it's supposed to have two more query parameters one for the authentication URL and one for the return URL
I've been trying to set up google oauth for the android version of the application that I'm building. Below you will find a code snippet of the initial set up that I had. I have gone through several iterations of how I've been setting up the code to work with the android version however the error that I keep getting is a URI redirect mismatch. I understand what the error means but I'm not sure what I'm doing wrong.
In the google developers console in the android section, there are 3 inputs where I can enter information.
name: this doesn't matter AFAIK
Package.name: I've tried to set this either the scheme in my app.json or the android.package name
SHA-1 Fingerprint certificate: I got this value from doing eas credentials.
I'm fairly certain that I'm screwing up the package.name input.
App.json scheme: com.john-doe.mobile-client
android.package: com.john-doe.appname_android
Im going to make the scheme and the package name the same then will rebuild. I will probably need to update the sha-1 fingerprint certificate also after a rebuild. Once the build is done I'll come back to update this but I'm honestly stumped.
import { useAuthRequest } from "expo-auth-session/providers/google";
WebBrowser.maybeCompleteAuthSession();
const [request, response, promptAsync] = useAuthRequest({
androidClientId:
"myadroid-client-id.apps.googleusercontent.com",
iosClientId:
"myios-client-id.apps.googleusercontent.com",
});
// refactor this to not use useEfffect.
useEffect(() => {
if (response?.type === "success") {
const { authentication } = response;
const accessToken = authentication?.accessToken;
if (accessToken) {
saveAuthToken(accessToken)
.then(() => refreshSession())
.then(() => router.push("/"))
.catch((error) => {
console.error("Error saving token:", error);
});
}
}
}, [response]);