AuthSession Google.useIdTokenAuthRequest() opens the app again on the prompt

SDK Version: 44.0.6
Platforms: Web

I’ve been trying to setup Google Authentication with Expo’s AuthSession. I’m currently using the following code:

  const [, response, signInWithGoogle] = Google.useIdTokenAuthRequest({
      "<id for Expo Go>",
      "<id for standalone android app>,
      "<id for web>",

I use the signInWithGoogle() function to open the Sign In popup and then get the information form the response.

On Android (both Expo Go and Standalone) it works flawlessly. On web though, the popup just reopens my app again inside of it and doesn’t do anything at all (after I select my Google account). If I close the new app the original one gets a “dismiss” response type.


I’ve noticed the new window has some information after the localhost:19006 in the url too.

How can I fix this?

Hi @fdelu

As you mentioned that you were able to authenticate google both in Expo Go and Standalone.
Could you please help me out to authenticate google in the standalone app.
I have tried the below approaches to login via Google but facing issues where are:

  1. When I remove the scheme in the app.json file and try to authenticate google, I am getting a response as type: dismiss instead of success and not getting the access token.

  2. When I added the intent filters of Scheme in the android object from the app.json, try to authenticate google, I am being popped out with two apps.

Could you please let me know what configuration details or approach you have followed.
Here are my packages/version details used:
SDK Version: 44,
Platform: Android

Sasanka M

No clue what could cause that :frowning:
Check that the final apk you get has the correct package name maybe

Hi @fdelu

Yes, I have checked everything and not finding out any clue.

Here are some of the issues with the google OAuth
`. App appears twice on the “Open with” list after google auth - Expo SDK - Forums
2. AuthSession returns dismiss result on Android standalone app · Issue #12044 · expo/expo · GitHub

Could you please share a sample code of yours?
Like I am not sure how did you succeed in the google authentication in the Standalone app as the first link provided is still open and if you have succeeded then you have been prompted with a window where the app will be displayed twice to open after you google oauth which describes the second link above.

Please let me know your response and how have you handled the google OAuth for android & iOS in the standalone.

Sasanka M

The code I already posted is literally all the code I use of this library. With Google.useIdTokenAuthRequest() I get an id_token with which I then make a credential using firebase’s GoogleAuthProvider.credential() and log in with that. Here’s my Google Sign In button component, with the client IDs removed:

import * as Google from "expo-auth-session/providers/google";
import { Button } from "react-native-paper";
import {
} from "firebase/auth";
import { useEffect } from "react";
import PropTypes from "prop-types";
import styles from "../styles.js";

export function GoogleSignIn({ onSignIn }) {
  const auth = getAuth();
  const [, response, signInWithGoogle] = Google.useIdTokenAuthRequest({

  useEffect(() => {
    if (response?.type != "success") return;

    onSignIn(async () => {
      const { id_token } = response.params;
      const credential = GoogleAuthProvider.credential(id_token);
      await signInWithCredential(auth, credential);
  }, [response]);

  return (
    <Button onPress={() => signInWithGoogle()} style={styles.button}>
      Sign in with Google

GoogleSignIn.propTypes = {
  onSignIn: PropTypes.func.isRequired,

onSignIn is just a function that executes the parameter within a try closure to catch any errors and display them.

Worth nothing: I’m not developing for iOS.

Thanks for sharing the code.

Let me try building a .apk file and see if I am able to get the response. type as success.

Sasanka M

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