Cariarer
Cariarer

Reputation: 136

Return URL with Angular 6, angular-oauth2-oidc and IdentityServer 3

I have an angular 6 application, using JWT and IdentityServer 3 for authentication. Everything works as expected. However, I send an detail link from the application via email. If a user clicks the link, the browser opens with the URL, redirects to the identity server and uses the AD to login. After this, the application returns to the default application root view, loosing the clicked URL.

I have searched quite a bit, but I never found a full solution to my problem. I save the location.href to session storage on "ngOnInit" and redirect to this, after I receive the event "token_received" from angular-oauth2-oidc. However, this doesn't seem to work, as it saves the link with the token in the URL, not my initial call.

What is the solution to this problem?

Upvotes: 1

Views: 1454

Answers (2)

callee.args
callee.args

Reputation: 439

Use state parameter or store state against the nonce in localStorage. More details here:

https://auth0.com/docs/protocols/oauth2/redirect-users

Upvotes: 0

Noman Fareed
Noman Fareed

Reputation: 284

As the application you have registered on AD, you must have configured a redirectURI for you application. So after successful authentication it will always redirects to that redirectURI you have configured for the application.

Upvotes: 0

Related Questions