[Authorize]
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "Simple" , "Test"};
}
}
This is a simple "Web API 2" app.
public void ConfigureAuth(IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new TokenValidationParameters
{
SaveSigninToken = true,
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
},
});
}
As shown the application is using the WindowsAzureActive Directory authentication and Authorization.
Note that it works normally when published to Azure Api App, but always denies the request when in localhost.
I am not sure what happened, it used to work before.
Regards