I have configured my Web application to use Azure Auth logon. Everything works fine and users can logon if they're not already logged on to Azure.
My issue is that when a user is already logged into Azure of Office 365 and they browse to my site, they get this error below. I understand what the error means, but I want to know if there is a way to redirect to another URL (on my site) if this issue occurs. Here is that error:
This is my startup code for configuring OpenId Auth:
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions {
ClientId = Configuration.clientID,
Authority = authenticationAuthority,
PostLogoutRedirectUri = Configuration.logoutRedirectURL,
Notifications = new OpenIdConnectAuthenticationNotifications {
AuthenticationFailed = context => {
context.HandleResponse();
context.Response.Redirect("/Unauthorised.aspx?message=" + context.Exception.Message);
return Task.FromResult(0);
}
}
});