Help Needed: Callback URL Mismatch Error with Auth0 and Expo (React Native)

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:

  1. 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',
});
  1. 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
  1. 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! :folded_hands:

Hi @noxi_eu

Welcome to the Auth0 Community!

If the only error that you are receiving would be the Callback URL Mismatch one, then most probably the url have not been configured correctly inside the application.

Otherwise, are you using our React Native SDK with Expo? On our SDK page, it is mentioned that:

This SDK is not compatible with “Expo Go” app. It is compatible only with Custom Dev Client and EAS builds

You did mention that this issue persists on an EAS Build, I am just gathering more information on the matter.

Otherwise, could you please provide me the name of the tenant and application in an DM so I can take a look myself at your configuration? Also, would it be possible to share a github repository with the application code so I can check that out as well? It would help considerably in troubleshooting the situation.

If you have any other questions on the matter, please let me know!

Kind Regards,
Nik