Post Sign-out Redirect
See original GitHub issueApologies 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:
- Created 3 years ago
- Reactions:1
- Comments:26 (1 by maintainers)
Top GitHub Comments
@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?
@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
Sample code
Final rendered output
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?