We have an application which also has some api controllers that should be called with authentication token and there are some other api/regular controllers which should use open id connect cookie based authentication. Below is the code from Startup.Auth.cs
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseKentorOwinCookieSaver();
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{ CookieSecure = CookieSecureOption.Always });
app.UseOpenIdConnectAuthentication(CreateOptionsFromPolicy(PasswordResetPolicyId));
app.UseOpenIdConnectAuthentication(CreateOptionsFromPolicy(SignUpSignInPolicyId));
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
},
});
}
we have one diff windows app which after adding user credentials should call the api controller methods using token. It does call the api method but in response we get a html login page ui code. OK status is received but instead of this login page code we should get the value returned by the api method. This method does not get executed because authentication is somehow creating problem.