Hello,
Just in case it helps others, I implemented the workaround advised above by Rukmini in my .Net Core 9 c# Razor Pages web app by adding an options.Events.OnRedirectToIdentityProvider handler to AddMicrosoftIdentityWebApp, and it works. However, of course the user experience is degraded as there is no silent login even when the token would still be valid. Any updates on getting a proper fix for this?
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(options =>
{
builder.Configuration.Bind("AzureAd", options);
options.SaveTokens = true;
options.Events.OnRedirectToIdentityProvider = (context =>
{
context.ProtocolMessage.Prompt = "select_account";
return Task.CompletedTask;
});
});