Skip to content Skip to sidebar Skip to footer

Identity Server: Redirect After Login And Logout In Angular?

I use IdentityServer in an Angular project based on .NET Core and I use the Identity Server razor login page by modifying it. Except from this login page, I use Angular pages and r

Solution 1:

What you are going to want to do is set up your IdentityServer client configuration to to point to those different components via the RedirectUris and PostLogoutRedirectUris. Then within the Angular application, when you are configuring the UserManager instance set the redirect_uri and post_logout_redirect_uri where you want the Identity Server to redirect to after the Login/Logout methods complete. These configurations need to match up between the client and server otherwise IdentityServer will reject the request. A sample app from Brock Allen for Angular sheds some light on this, Angular oidc-client.js.

Once the configuration is completed the redirects should be automatic and you shouldn't need to modify the redirects in IdentityServer. That only covers the Login/Logout flows. I see you have register and failed login definitions within the Angular app. What you could do is modify the View Controllers to redirect the user via a return Redirect("some\url\to\angular\component"); to send the user to that component.

Post a Comment for "Identity Server: Redirect After Login And Logout In Angular?"