Auth0 with React

I’ve followed through Auth0’s guide for how to setup a React app using Capacitorjs to deploy to android and Auth0 for authentication. I’m actually using the sample that can be downloaded from: Auth0 Ionic & Capacitor (React) SDK Quickstarts: Login

When I click login in the app I get redirected to the Auth0 hosted login page as expected. I can then login and get redirected back into the android app but the app doesn’t register that the users logged in.

I’ve completed all the Auth0 admin settings and can see in the network logs that a bearer token is being issued. It just doesn’t seem like anything happens when the user is returned to the app.

Any ideas?

Figured this out. The instructions specify to set Allowed origins and by default there is a property named Allowed web origins in the Auth0 Application settings.

However in addition to this Cross-Origin Authentication needs to be switched on and the following domains added to Allowed Origins (CORS)

capacitor://localhost, http://localhost, http://localhost:3000/, https://localhost

If you don’t do this the following error will appear in the logs.

Origin https://localhost is not allowed. Behavior used for check: LEGACY