I have had the same 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.
Answer from bonbonvoyage on Stack Overflowreact native - expo-auth-google to expo-auth-session - Stack Overflow
react native - Google Redirect Url For Development Setup Using Expo-auth-session - Stack Overflow
[expo-auth-session] I'm unable to sign in with Google on Android
Google sign in works on expo go but it doesn't work on standalone app
Videos
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?
» npm install expo-auth-session
Hello everyone, im trying to implement google sign in to my app, but i cant make it work on my build (expo go is working). So far i've tried enabling custom uri schemes on google console but after signin nothing happens, the app just keeps on loading. I've tried adding a redirectUri but that gets me the error "Error 400: invalid_request", Details: "redirec_uri=exp://my-slug-here". So my question is, how can i set up this properly? Any help is really appreciated, here's my code:
import * as WebBrowser from "expo-web-browser";
import * as Google from "expo-auth-session/providers/google";
import * as AuthSession from 'expo-auth-session';
const redirectUri = AuthSession.makeRedirectUri({
useProxy: false,
native: 'exp://slug-here',
});
const [request, response, promptAsync] = Google.useIdTokenAuthRequest({
clientId:
"clientId",
androidClientId: "androidId",
redirectUri
});
this is working for me
import { makeRedirectUri } from 'expo-auth-session';
import Constants from 'expo-constants';
import * as Google from 'expo-auth-session/providers/google';
const EXPO_REDIRECT_PARAMS = {
useProxy: true,
projectNameForProxy: '@yourUsername/yourScheme',
};
const NATIVE_REDIRECT_PARAMS = { native: 'yourScheme://' };
const REDIRECT_PARAMS =
Constants.appOwnership === 'expo'
? EXPO_REDIRECT_PARAMS
: NATIVE_REDIRECT_PARAMS;
const GOOGLE_CONFIG = {
androidClientId: '...',
webClientId: '...',
iosClientId: '...',
redirectUri: makeRedirectUri(REDIRECT_PARAMS),
};
const LoginPage = ()=> {
const [request, response, promptAsync] = Google.useAuthRequest(GOOGLE_CONFIG)
...
}
i get invalid_request and i cant solve it. im trying with Expo Go and Native. Same problem. Could anyone give me a hand please?.
import { makeRedirectUri } from "expo-auth-session";
import * as Google from "expo-auth-session/providers/google";
import { LinearGradient } from "expo-linear-gradient";
import { router } from "expo-router";
import * as WebBrowser from "expo-web-browser";
import { useEffect } from "react";
import { Image, StyleSheet, Text } from "react-native";
import SocialLoginButton from "./commons/socialLoginButton";
WebBrowser.maybeCompleteAuthSession();
export default function LoginScreen() {
const redirectUri = makeRedirectUri({
scheme: "app",
});
console.log("Redirect URI:", redirectUri);
const [request, response, promptAsync] = Google.useAuthRequest({
webClientId: "",
androidClientId: "",
scopes: ["profile", "email"],
redirectUri,
});
useEffect(() => {
if (response?.type === "success") {
const { authentication } = response;
fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
headers: { Authorization: `Bearer ${authentication?.accessToken}` },
})
.then(res => res.json())
.then(userInfo => {
console.log("Google User Info:", userInfo);
router.replace("/homeScreen");
});
}
}, [response]);
return (
<LinearGradient colors={["#6EC1E4", "#8364E8"]} style={styles.container}>
<Image
source={require("../assets/images/logo-blanco.png")}
style={styles.logo}
resizeMode="contain"
/>
<Text style={styles.title}>Hubbly</Text>
<Text style={styles.subtitle}>Log in and connect with new experiences.</Text>
<SocialLoginButton
backgroundColor="#4285F4"
icon="google"
text="Inicia sesión con Google"
textColor="#fff"
onPress={() => promptAsync()}
/>
</LinearGradient>
);
}
const styles = StyleSheet.create({
container: { flex: 1, justifyContent: "center", alignItems: "center", paddingHorizontal: 20 },
logo: { width: 100, height: 100, marginBottom: 20 },
title: { fontSize: 28, fontWeight: "bold", color: "white", marginBottom: 10 },
subtitle: { fontSize: 16, color: "white", textAlign: "center", marginBottom: 40 },
moreButton: { flexDirection: "row", alignItems: "center", marginTop: 16 },
moreText: { color: "#fff", fontSize: 16, marginRight: 5 },
terms: { color: "#fff", fontSize: 12, textAlign: "center", marginTop: 30, paddingHorizontal: 20 },
});
I’m working on integrating Google Calendar OAuth into my React Native app using Expo, and I’m running into an issue where the redirect URI returned by makeRedirectUri({ useProxy: true }) is wrong — it’s always exp://127.0.0.1:8081, even though I’m expecting the Expo proxy URI (e.g. https://auth.expo.io/@username/myapp) to be returned.
I’ve been debugging this for hours and would really appreciate any advice or insight.
Some Context:
I’m using expo-auth-session version ~5.5.2 My app is built with Expo Router and uses OAuth to Google Calendar I want to allow users to connect their Google Calendar and add events from our app I’m using web-based OAuth, not direct sign-in or server-side flows Running locally via expo & Android studio
This is my code snippet:
import { makeRedirectUri, useAuthRequest, ResponseType } from 'expo-auth-session'; import * as WebBrowser from 'expo-web-browser'; import { useEffect } from 'react'; import config from '@/config';
WebBrowser.maybeCompleteAuthSession();
const discovery = { authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', tokenEndpoint: 'https://oauth2.googleapis.com/token', };
export function useGoogleAuth() { const redirectUri = makeRedirectUri({ useProxy: true, scheme: 'my app name', });
console.log('[useGoogleAuth] redirectUri =', redirectUri);
const [request, response, promptAsync] = useAuthRequest( { clientId: config.googleClientId, scopes: ['https://www.googleapis.com/auth/calendar.events'], redirectUri, responseType: ResponseType.Code, extraParams: { access_type: 'offline', prompt: 'consent', }, }, discovery );
useEffect(() => { console.log('[useGoogleAuth] response =', response); }, [response]);
return { promptAsync, request, response }; }
And yes I added authorized uris and authorized test users in Google cloud console.
I also added the redirect URI: https://auth.expo.io/@myusername/myapp to google.
My questions: • Why is makeRedirectUri({ useProxy: true }) still giving me exp://127.0.0.1:8081? • Is there some config I’m missing in app.json, expo-router, or somewhere else? • Should I upgrade expo-auth-session or use a different method to get the correct proxy URI?
Thanks