on the Android side, How to open the login page normally when the application package name contains uppercase letters
Checklist
- [X] The issue can be reproduced in the react-native-auth0 sample app (or N/A).
- [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
The application package name contains uppercase letters, and callbackUrl has been set to lowercase letters. Setting customScheme cannot open it properly.
I hope to not change the application package name and be able to use auth0 normally.
Please provide some solutions, thank you.
Reproduction
- In the auth0 console, callbackUrl has been set to lowercase letters (e.x. com.testapp.auth0://auth0.com/android/com.testapp/callback)
- The package name in the application contains uppercase letters (e.x. com.testApp)
- Accessing webAuth.authorize, customScheme has been set (e.x. customScheme: com.testApp.auth0)
- The app/build.gradle has added the manifestPlaceholders setting (e.x. manifestPlaceholders=[auth0Domain: "auth0.com", auth0Scheme: "${applicationId}.auth0"]). The applicationId is com.testApp.
- Android: launchMode="singleTask" has been removed from AndroidManifest.xml
Additional context
No response
react-native-auth0 version
3.1.0
React Native version
0.73.4
Expo version
No response
Platform
Android
Platform version(s)
34
Solved it. Please refer to No.1:https://github.com/auth0/react-native-auth0/blob/master/FAQ.md
But there is another issue. After the first successful login, the same email will be logged in again and the login page will be automatically skipped.
Please help
But there is another issue. After the first successful login, the same email will be logged in again and the login page will be automatically skipped.
Please help
@cx5168 Have you solved the issue, and could you provide the details how you solved in in the first comment? I read the first point but it still doesn't work for me.
@kulaszewicz
- On the management side of auth0, set the value of callbackURL to lowercase letters
- Delete the manifestPlaceholders setting for app/build.gradle
- In AndroidManifest.xml, add the following line
<activity android:name="com.auth0.android.provider.RedirectActivity" android:exported="true" tools:node="replace"> <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:host="[your auth0 host]" android:pathPrefix="/android/[Lowercase applicationId. ex: aaa.com]/callback" android:scheme="[Lowercase applicationId. ex: aaa.com].auth0" /> </intent-filter> </activity> - delete the build folder for app
- rebuild
I found that version 3.2.1 simply does not work with Expo and custom scheme. After updating to the v4 beta, everything works as expected!
Hope this helps someone not waste the hours I did not just trying the latest version....
@GriffinMeyer sorry you had to spend time on this! thanks for confirming that this issue is resolved on v4 beta.
@cx5168 could we close this issue now?
Upgrading to v4.0.0 should resolve the issue with custom schemes and different casing between your app package name and callback URL.
If you continue to face problems after updating, please reopen this issue with any additional details. Thanks.
I just hit this issue with 5.0.1 on Expo. I tried to set the customScheme to the lowercase variant which fixed the callbackUrl, but that didn't fix the auto-generated intent-filter in the AndroidManifest file. The pathPrefix still contains the uppercase package name which causes that after a successful authentication the callbackUrl never opens up the app. can we reopen this issue @arpit-jn?
I've taken a quick look at the source as well and I think the issue can be fixed here:
https://github.com/auth0/react-native-auth0/blob/92b3637023275bd59590cea96ecf886c47306bfb/src/plugin/withAuth0.ts#L104C23-L104C46
if we would lowercase the applicationId on this line, that would fix the intent-filter.
Especially that you're already lowercasing the bundleId when generating the callbackUri: https://github.com/auth0/react-native-auth0/blob/92b3637023275bd59590cea96ecf886c47306bfb/src/platforms/native/adapters/NativeWebAuthProvider.ts#L128
lmk if you agree and I can spin-up a PR with this fix @arpit-jn