So I have a newly created netcore application linked to my azure active directory account with middleware setup as follows:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
ClientId = Configuration["Authentication:AzureAd:ClientId"],
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
Events = new OpenIdConnectEvents
{
OnAuthenticationFailed = OnAuthenticationFailed,
OnAuthorizationCodeReceived = OnAuthorizationCodeReceived
}
});
My Callback path a default of "CallbackPath": "/signin-oidc", and my azure sign on url is http://localhost:20352/ with a reply url of http://localhost:20352/signin-oidc
Now I can go through the sign in process fine, but if you hit the browser back button a few times I'm hitting this blow up:
An unhandled exception occurred while processing the request.
Exception: Correlation failed. Unknown location
AggregateException: Unhandled remote failure. (Correlation failed.) Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d__5.MoveNext()
How or where can I catch this exception to handle it accordingly? Or is there something wrong with my middleware setup that is causing this.
The two events above are never hit.
Edit: May be helpful to know the blow up URL from the browser back button is "http://localhost:20352/signin-oidc"
Which this obviously doesnt exist as a valid controller / action route