Redirect user to custom login page when using Azure AD
After some re going over the code I've found the solution to my issue.
Within Startup.Auth.cs
:
app.UseCookieAuthentication(new CookieAuthenticationOptions {
LoginPath = new PathString("/Account/Login")
});
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions {
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUri,
AuthenticationMode = AuthenticationMode.Passive
});
It's the inclusion of the AuthenticationMode = AuthenticationMode.Passive
line which seems to stop OpenIdConnectAuth from performing the automatic 302 redirect to the AAD login pages.