Auth0 Home Blog Docs

"State" does not match. Ionic Auth0-js using Capacitor

Hello There,

We are using Ionic v4 with Capacitor, using only the Auth-js library.

We are calling this.auth0.authorize() which will redirect to our auth0 page to authenticate, and then after the user logs in, the callback is going to open the app using deep links. Once the callback returns to the app, though I’m setting window.location.hash with the hash provided from the callback from Auth0. After executingthis.auth0.parseHash I get => state does not match.

I already check that I’m not calling parseHash multiple times. It’s only being triggered when the hash is present which is one time in this case.

Let me know any insights, share my code, etc.

Is it possible that there is a refresh happening somewhere? Posting code and/sending me a HAR via DM would be helpful to get to the bottom of this.

Thanks,
Dan

I sent the .har file via DM.

I followed this article while building our App. https://auth0.com/blog/ionic-4-beta-whats-new-and-building-a-sample-app/ .

I will say, it works on the browser perfectly but when emulating to the Device or on Test Flight. It throws the error about the state doesn’t match.

Checked and there’s no refresh happening, the app opens from Auth0 and parseHash gets executed but I get that error

I took a look at the HAR, and I don’t see a call to the /authorize endpoint. Is there a redirect happening between browsers somewhere?