question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Post Sign-out Redirect

See original GitHub issue

Apologies if I’ve missed this in the documentation, samples, or source code!

What I’d like to achieve is the ability to, after the user clicks Sign-Out, redirect the user back to the home screen of the application. Currently they are left on the “it is a good idea to close all of your browser windows” screen.

I’m running an ASP.NET Core 3.1 MVC application, using Microsoft.Identity.Web/Microsoft.Identity.Web.UI 0.2.3-preview. The sign-out button uses the action hosted by Microsoft.Identity.Web.UI as below.

<a asp-controller="Account" asp-action="SignOut" asp-area="MicrosoftIdentity">Sign-out</a>

This sign-out is very helpful in the scenarios where: (1) the user is stuck in a broken app, where an error has occurred in an AJAX component (2) the user has changed roles and need a fresh claims token

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:26 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
shanemikelcommented, Nov 10, 2020

@jmprieur I want my users to see a custom SignedOut page, not the one at /MicrosoftIdentity/Account/SignedOut. I’m using Blazor, and the MicrosoftIdentity MVC page doesn’t render with my site layout. Is there a way to do that?

3reactions
abhisheksiddhucommented, Dec 6, 2020

@markholst @shanemikel I was struggling with this and came up with a solution. Maybe it would help others as well.

Since under the hood this is just another razor page, it can be overridden by a UI that we want. It’s a similar approach that was done before this Identity web library came into the picture.

You can create a razor page at the exact same path and it will use the provided UI instead of the default.

This is where the file needs to go image

Sample code image

Final rendered output image

You can get the code of the default UI from here and customize accordingly https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web.UI/Areas/MicrosoftIdentity/Pages/Account/SignedOut.cshtml

@jmprieur Can you confirm if that’s the expected approach to take?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redirect Users with Alternative Logout
You can redirect users to a specific URL after they logout. You will need to register the redirect URL in your tenant or...
Read more >
What is the point of PostLogoutRedirectUri in Open Id/ ...
A client uses the post logout redirect URI to log out in a controlled way, typically redirecting to an application page that gives...
Read more >
Post logout redirect url - should redirect to login page ...
When I give the below URL, it logs me out and says "you signed out of your account" but have trouble redirecting it...
Read more >
Federated post logout redirects
When a client application is signing out of IdentityServer, a “post-logout redirect uri” can be passed to request that the user is redirected...
Read more >
Returning to the Client
If there is a PostLogoutRedirectUri value, then it's important how this URL is used to redirect the user. The logout page typically should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found