Skip to content

Duplicate App prompted on Android #1410

@MockAirplane700

Description

@MockAirplane700

Checklist

Description

When users on Android for an application built on expo React Native, attempt to login or logout, they are prompted the same application twice, being asked which one to open. Please see the attached screenshots.

Image

I attempted multiple solutions I found in different issues already posted and closed but the most I was able to do was preven the dupplication bug from occuring in Development mode but in production the application would crash on being opened with an error message about malformed intents.

I have been able to determine that the origin most likley comes from duplicate intents created in the android/app/src/main/AndroidManifest.xml where we have one from expo deep linking and or expo router and another from react-native-auth0 package hence when the user logs in or logs out because they are two duplicate intents, the OS prompts the user to pick between the two.

Here are the duplicate intents I identified in the AndroidManifest.xml

<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <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="zurigardens"/>
        <data android:scheme="exp+zuri-gardens"/>
      </intent-filter>
      <intent-filter android:autoVerify="true" data-generated="true">
        <action android:name="android.intent.action.VIEW"/>
        <data android:scheme="blackvalleycomicsplatform" android:pathPrefix="/android/dev.siziba.black_valley_comics/callback"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
      </intent-filter>
</activity>

 <activity android:name="com.auth0.android.provider.RedirectActivity" tools:node="replace" android:exported="true">
      <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="blackvalleycomicsplatform" android:pathPrefix="/android/dev.siziba.black_valley_comics/callback" android:host="dev-vttkdxzvui4y8a11.us.auth0.com"/>
      </intent-filter>
</activity>

The behaviour was duplicated in a seperated project as well, please see the screenshot below

Image

Here is the android block from the relevent app.json

"android": {
      "edgeToEdgeEnabled": true,
      "predictiveBackGestureEnabled": false,
      "versionCode": 1,
      "package": "package_name",
      "intentFilters": [
        {
          "action": "VIEW",
          "autoVerify": true,
          "category": [
            "DEFAULT",
            "BROWSABLE"
          ],
          "data": {
            "scheme": "Auth0 scheme",
            "pathPrefix": "/path/prefix"
          }
        }
      ]
    },

Reproduction

  1. Create an expo app, can use npx create-expo-app@latest
  2. Follow the steps provided on Auth0 guide for Expo React Native app Expo Auth0 guide
  3. Add the react-native-auth0 plugin with the needed relevant values adding the domain and a custom scheme
  4. To the android block in app.json add the intent filters with a scheme and path prefix
  5. Run development build on android and attempt to login

Additional context

No response

react-native-auth0 version

5.2.1

React Native version

0.81.5

Expo version

54.0.29

Platform

Android

Platform version(s)

Gradle 8.14.3 , Android SDK API level 36

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions