I am developing ASP.NET Web API application with Identity 2.0 Bearer authentication. I have configured bearer authentication and implemented SignIn method, so that when I pass header:
Authorization: Bearer uGjAWZA1nPc1AqPuKpAzPhb989SYbtGd...
It works normally. I can call User.Identity.GetUserId() or User.Identity.GetUserName(). I even can check if user is in some role or not, and it also works good.
What is doesn't work, is [Authorize] attribute. When I specify roles, like that [Authorize(Roles = "Admin")] it returns:
{
Message: "Authorization has been denied for this request."
}
Any thoughts?