I’m building an Expo React Native app and trying to implement Google Sign-In using
`expo-auth-session` and `expo-auth-session/providers/google`.
Environment:
– React Native (Expo Router)
– Running in Expo Go on iOS
– Google OAuth client IDs created in Google Cloud:
– Web application
– iOS
– Android
import { AntDesign } from '@expo/vector-icons';import AsyncStorage from '@react-native-async-storage/async-storage';import * as Google from 'expo-auth-session/providers/google';import { useRouter } from 'expo-router';import * as WebBrowser from 'expo-web-browser';import React, { useCallback, useEffect, useState } from 'react';import { Alert, Button, Pressable, Text, View } from 'react-native';
import IconFacebook from '../../../icons/IconFacebook';import IconGoogle from '../../../icons/IconGoogle';
WebBrowser.maybeCompleteAuthSession();
export default function LoginScreen() { const router = useRouter(); const [, setUserInfo] = useState
const redirectUri = '
const [request, response, promptAsync] = Google.useAuthRequest({ expoClientId: '8263....apps.googleusercontent.com', iosClientId: '8263...apps.googleusercontent.com', androidClientId: '8263332....apps.googleusercontent.com', webClientId: '8263332....apps.googleusercontent.com', scopes: ['profile', 'email'], redirectUri, });
useEffect(() => { console.log('Google redirectUri =', request?.redirectUri); }, [request]);
// ...fetchUserInfo + UI omitted for brevity}
On the Google Cloud side, my Web application client with ID:'8263332....apps.googleusercontent.com'
has this Authorized redirect URI configured:
So I expect that, when running in Expo Go with expoClientId/webClientId, the OAuth request will use that web client and redirect URI.
However, when I start the login flow and log the generated request, I see this:OAuth Request: { redirectUri: "", request: { clientId: "826333210617-dogrjmu5121isqo1gdnblogr23j6qh6b.apps.googleusercontent.com", // <-- iOS client ID redirectUri: "", responseType: "code", scopes: ["profile", "email", "openid", ...], url: " redirect_uri=https%3A%2F%2Fauth.expo.io%2F%40trieuman2705%2Fbkoo& client_id=826333210617-dogrjmu5121isqo1gdnblogr23j6qh6b.apps.googleusercontent.com &response_type=code&state=...&scope=..." }}
And in the browser I get this error page from Google:Error 400: redirect_uri_mismatch(Details mention flowName=GeneralOAuthFlow, but the main message is redirect_uri_mismatch)
So Google is seeing:client_id = iOS client IDredirect_uri =
but that redirect is configured for the Web client, not for the iOS client. I’m confused about why expo-auth-session is picking the iOS client ID for this flow when I’m running in Expo Go and I’ve also provided expoClientId/webClientId.