App appears twice on “Open with” list after google auth

When a user click on ‘SignIn with Google’ button, an auth0 login page opens in the browser and upon successful signing in, the popup allowing to choose with which app the user wants to continue the process, appears. And it’s my app which shows up twice. Any idea what might be the reason for that?

Library Used:

expo-auth-session

Versions:

expo -V
4.10.0

expo sdk '42.0.0'

"workflow": "managed"

My app.json:

"name": "Edukuu",
...
"scheme": "com.edukuu.edukuuapp",
1 Like

Hi! I’m experiencing the same behavior using WebBrowser.openAuthSessionAsync, when the redirect gets fired.
Looks like it offers to open existing instance or create a new one, or something like that. Tapping one of the options the flow continues as expected, other one fails.

UPDATE: I just avoided it, I had set scheme and android.package with the same string value in the app.json file. I changed the value of scheme and it redirected as I wanted to, without opening the ‘Open with’ modal with the app showing twice. Hope it helps you too.

Hi! Thanks for the suggestion. I tried changing the value of my scheme in app.json to something different from android.package. And just like you said it did redirected to my app without showing ‘Open with’ modal, but authentication failed. I guess it fails to pass the authentication info back to the app.

I am following this Authentication - Expo Documentation guide with WebBrowser.maybeCompleteAuthSession(). And the document says Your app needs to conform to the URI scheme matching your android.package (ex. com.myname.mycoolapp:/).

Could you please the share the code snippet of how you are using WebBrowser.openAuthSessionAsync to get the desired behaviour. Thanks!

@puneetbhakar Did you get your issue resolved? I’m experiencing the exact same issue. I’m also using deep linking in react navigation and wondered if that was creating a duplicate scheme.

@agrc No, I could not resolve the issue. But then I switched to expo-google-sign-in. This works seamlessly on Android, though I haven’t tested it on iOS.

I’ve found the problem but I’m not sure on what the solution is. In AndroidManifest.xml within my standalone apk, I’ve found that there are duplicate intent-filters:

<activity
            android:theme="@ref/0x7f12021b"
            android:name="host.exp.exponent.MainActivity"
            android:launchMode="2"
            android:configChanges="0x6b0"
            android:windowSoftInputMode="0x10">

            <intent-filter>

                <data
                    android:scheme="gov.dts.ugrc.utahwvcr" />

                <action
                    android:name="android.intent.action.VIEW" />

                <category
                    android:name="android.intent.category.DEFAULT" />

                <category
                    android:name="android.intent.category.BROWSABLE" />
            </intent-filter>

            <intent-filter>

                <action
                    android:name="android.intent.action.MAIN" />

                <category
                    android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

and

<activity
            android:name="net.openid.appauth.RedirectUriReceiverActivity">

            <intent-filter>

                <action
                    android:name="android.intent.action.VIEW" />

                <category
                    android:name="android.intent.category.DEFAULT" />

                <category
                    android:name="android.intent.category.BROWSABLE" />

                <data
                    android:scheme="gov.dts.ugrc.utahwvcr"
                    android:path="oauthredirect" />
            </intent-filter>
        </activity>

I’m assuming that the second one is added by the expo-auth-session stuff. Currently my app.config.js is using the same bundle id for both the scheme and android.package props according to the documentation that @puneetbhakar referenced above.

However, if I set scheme to be something different, then the auth request successfully redirects back to my app but it returns {type: 'dismiss'}. I’m not sure where to turn and I don’t want to have to use a different package. Any other ideas?

Hey. Ran into this same issue while using intentFilters as a workaround for another problem related to AuthSession not working in Android standalone: The google login not completed the process in the .apk file but in the Android emulator work fine. · Issue #10860 · expo/expo · GitHub

I was able to prevent the “double app” issue with the following approach:

  1. Add a unique identifier to your intentFilter scheme (I suffixed it with .auth):
      // Workaround for sign in issues
      config.android.intentFilters = [
        {
          action: 'VIEW',
          category: ['BROWSABLE', 'DEFAULT'],
          data: {
            scheme: `${PRODUCTION_BUNDLE_ID}.auth`,
          },
        },
      ];
  1. Modify your makeRedirectUri using your unique scheme (ending with ://) like this:
const redirectUri = AuthSession.makeRedirectUri({
  native: Platform.select({
    /**
     * Workaround for app appearing twice on "Open with" prompt.
     * https://forums.expo.dev/t/app-appears-twice-on-open-with-list-after-google-auth/55659
     */
    android: `${Constants.manifest?.android?.package}.auth://`,
    default: undefined,
  }),
});

In my app, this bypasses the “Open with” prompt and signs in the user. Hope this serves as a good workaround.