Auth0 redirect is not working properly, Angular automatically redirects to base route

Hello,

It seems I’ve found the answer to my question in this thread: Redirect URI issue after successful login with @auth0/auth0-angular

The solution was to add appState: { target: "/url" } as a parameter to the call to loginWithRedirect method.

I’ve tried this, and it works correctly.

This is really something that should be mentioned in your docs and in the Angular Quickstart and Angular Complete Guide. It’s very confusing for someone new to Auth0 and I believed it was an Angular issue, so I was looking at completely the wrong places for a solution.

I’d like to ask, given that the Auth0 SDK will redirect the user to the base route of their application regardless of the value of the redirect_url option in the call to loginWithRedirect, what is actually the point of this option? Is it so that the developer can add extra logic to a particular route and have Auth0 redirect to that route to execute the login after authentication? Or perhaps another reason?

I’m just curious why it exists as it’s confusing to expect the SDK to redirect to the supplied URL, when that doesn’t actually happen.

2 Likes