There is no clear way to define the SignedOut page. It is currently hardcoded.
I'd like to be able to define the URL, especially for cases where I just need the user back to an existing page like the home page.
The only way I found to do this currently is to create a razor page in my web app (Blazor Server in my case)
Areas/MicrosoftIdentity/Pages/Account/SignedOut.cshtml
I am having the same issue (also on Blazor server).
The path "MicrosoftIdentity/Account/SignedOut" is simply a blank page with the message "You have successfully signed out." (no menu etc.). This is to be expected as it is a Razer page and not in the Blazor app.
I would love to be able to redirect to a path (after the middleware signs the user out).
@ThatMouse and @BrettMahon you would need to override the page. Have you seen our wiki documentation on how to set this up? If you need more, please tag me.
closing for now.
I don't think this is a very good solution, since it would easily be solved by defining a URL. The best workaround for Blazor is to use a rewriter. This way I can redirect to a Blazor page and not use cshtml at all. This is in my Startup.cs in a Blazor app.
app.UseRewriter(
new RewriteOptions().Add(
context =>
{
if (context.HttpContext.Request.Path == "/MicrosoftIdentity/Account/SignedOut")
{
context.HttpContext.Response.Redirect("/");
}
}));
@jennyf19 @JasonImageOne I agree, for Blazor there should be another way to avoid MVC (cshtml) at all. A simple setting of a custom URL would be enough.
@jennyf19 Could we reopen? The main issue for me is I don't usually need a Signedout page anyway. It's probably not good practice to rely on that page getting hit either, i.e. session/cookies being cleared only on this page. Also, while we can override Signedout, I was never able to get a redirect to work at that point. So the best workaround for Blazor is a global redirect home. (@JasonImageOne is my work account.)
@ThatMouse : what would be, from your perspective, the best experience / the API you'd wish to have?
@ThatMouse : what would be, from your perspective, the best experience / the API you'd wish to have?
Make this path "MicrosoftIdentity/Account/SignedOut" configurable. I believe this is essentially hardcoded inside MicrosoftIdentityUI. For my purposes I want it to be "/" so the user sees my homepage after they've logged out.
Whatever the solution, it should be easier than the UseRewriter workaround. Maybe adding an IConfiguration to AddMicrosoftIdentityUI() ?
For reference, in Blazor Server, a number of settings are defined in appsettings.json using the method below. This way a number of other things could be configured as well.
startup.cs
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAdB2C"));
appsettings.json
"AzureAdB2C": {
"Instance": "https://xxxx.b2clogin.com/",
"ClientId": "xxx",
"CallbackPath": "/signin-oidc",
"Domain": "xxxx.onmicrosoft.com",
"SignedOutCallbackPath": "/noeffect",
"SignUpSignInPolicyId": "B2C_1_sign_up_in",
"ResetPasswordPolicyId": "B2C_1_password_reset",
"EditProfilePolicyId": "",
"ClientSecret": "changeme"
}