Google.useAuthRequest response is null

Please provide the following:

  1. SDK Version: 41
  2. Platforms(Android/iOS/web/all): iOS/Android
  3. expo-auth-session

I use expo-auth-session in a mobile app to prompt user with google login and get back id_token, which is used in our backend server auth api to verify the user.

If I set to exchange code immediately, everything works fine, but I won’t get the id_token back, only accessToken .

If shouldAutoExchangeCode: false and responseType: "id_token" are set, the response is null. After I save the document (without any changes) and app gets refreshed, the response with id_token is received, but this scenario is not usable in production.

import * as Google from 'expo-auth-session/providers/google';

const LoginScreen = (props) => {
    
    const [request, response, promptAsync] = Google.useAuthRequest({
        shouldAutoExchangeCode: false,
        responseType: "id_token",
        expoClientId: Constants.manifest.extra.dev.expoClientId
    });
    
    useEffect(() => {
        if (response?.type === 'success') {
            console.log(response)
        }
    }, [response]);
    
    return (
        <Button onPress={() => promptAsync()} />
    )
}

Is there any way to get the id_token from google auth response?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.