Hello, everyone!
I’m working on a React Native app using Expo and Auth0 for authentication, and I’m running into an issue with the callback URL mismatch. When I try to authenticate, the app opens a web tab to log in, but I get a “callback URL mismatch” error.
Here’s what I’ve done so far:
- App Configuration:
- I’m using Auth0 with a custom redirect URI.
- I’ve set the redirect URI in my app to:
js
KopiërenBewerken
const redirectUri = AuthSession.makeRedirectUri({
native: 'com.anonymous.MyApp://callback',
});
- Auth0 Dashboard Configuration:
- I’ve added both the following URLs to Allowed Callback URLs and Allowed Logout URLs in the Auth0 application settings:
https://auth.expo.io/@my-username/MyApp
com.anonymous.MyApp://callback
- app.json:
- I’ve defined the custom scheme in
app.json
:
json
KopiërenBewerken
{
"expo": {
"scheme": "com.anonymous.MyApp"
}
}
What’s happening:
- When I try to log in, it opens the Auth0 login page in a browser window, but I receive a callback URL mismatch error.
- I’ve double-checked the redirect URI in my app code and in Auth0’s settings, and everything seems to match up.
- Initially, I was testing the app using Expo Go, but I’ve now switched to using EAS Build for testing, hoping it would resolve the issue.
What I’ve tried:
- Confirmed that the callback URL in Auth0’s Allowed URLs matches exactly the one generated in my app.
- Made sure the scheme is correctly set up in
app.json
. - Tested on both a physical device and an emulator.
My question:
- Has anyone encountered this issue before?
- Could there be something I’m missing with Auth0 or Expo’s handling of callback URLs, especially when using EAS Build instead of Expo Go?
Any help or guidance would be greatly appreciated!
Thanks in advance!