Login/Redirect fails in production

I’m using Auth0 in an Angular app, and I just deployed a test build to production, where it fails outright upon login. Logs tell me that login is successful, but the code and state query params are being appended to the redirect uri, causing it to not recognize the callback route. I’ve encountered this issue in development and posted about it before ("Cannot match any routes" Error), but no resolution came out of that.

Hello @michaelscaveney and I’m sorry to hear you are still facing this challenge.

Let’s start off by reviewing the current version of Angular you are running and comparing how you are implementing Auth0 into your app. I have linked out Angular 2 SPA Quickstart as an example below. Also is this a public repo or private?

If you still run into challenges after referencing the quickstart, please direct message me a HAR file capture of the current breakdown paired with your tenant name. Please be sure to select “Preserve log” to catch redirects and scrub the file of user passwords before passing, thanks!

State reference:

So this code was using the quickstart code, pretty much verbatim. The issue is how Angular handles hash encoding, as described in this Stack Overflow thread (https://stackoverflow.com/questions/49182111/angular-encodes-hash-fragment-how-to-prevent-it/49183582). Since auth0-spa-js doesn’t have a parseHash function I had to change the handleAuthCallback code so that this.router.navigate([targetRoute]) becomes this.router.navigate([name-of-path-you're-redirecting-to]). Hopefully this will be addressed in the new Angular SDK.

1 Like

Thanks for the update @michaelscaveney, I’m looking forward to the new Angular SDK as well!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.