Hi.
It looks like what is happening is expected.
Our Angular SDK is configured to work as follows:
- User initiates login by calling loginWithRedirect
- User is redirected to Auth0, including a redirectUri (in this case /callback)
- User is, after succesful authentication, redirected back to the provided redirectUri (in this case /callback)
- The callback URL is used only to process code and state in order to retrieve an actual token
- The user is then redirected again to /
However, if you want to not be redirected back to /
in the very last step, but instead they want the user to end up at a different URL, they can do so by providing that information to loginWithRedirect()
:
loginWithRedirect({
appState: { target: '/some-url' }
})
By doing that, in the very last step the SDK will not redirect the user back to /
, but to /some-url
instead (see https://github.com/auth0/auth0-angular/blob/master/projects/auth0-angular/src/lib/auth.service.ts#L299).
I record the current path in local storage before calling this.authService.loginWithRedirect()
There is no need for doing this. If you provide that route to { appState: { target: ''}}
, our SDK will store it in Session Storage for you.