-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Checklist
- The issue can be reproduced in the react-native-auth0 sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
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.
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
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
- Create an expo app, can use npx create-expo-app@latest
- Follow the steps provided on Auth0 guide for Expo React Native app Expo Auth0 guide
- Add the react-native-auth0 plugin with the needed relevant values adding the domain and a custom scheme
- To the android block in app.json add the intent filters with a scheme and path prefix
- 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