0

I am doing Token Based Authentication Web API in ASP.NET Core using jwt. I can't understand why we need to use Bearer keyword in [Authorize("Bearer")] attribute on above the action method for authorization and i am not be able to do authorization role base or simple as in attached screenshot.enter image description here

see the below code

 // GET api/values
    [Authorize("Bearer")]
    [HttpGet]
    public IEnumerable<string> Get()
    {
        return new string[] { "value1", "value2" };
    }

i am following this link to do the authorization

Sumit Singh
  • 59
  • 1
  • 9
  • Possible duplicate of [Best HTTP Authorization header type for JWT](https://stackoverflow.com/questions/33265812/best-http-authorization-header-type-for-jwt) – lauda Jul 07 '17 at 18:59
  • No. I want to use role base authentication and authorization like i want to use [Authorize(Role="Admin")] – Sumit Singh Jul 10 '17 at 09:30
  • Strange, I don't have to use `Bearer` keyword and it all works fine for me. See my answer https://stackoverflow.com/a/52822924/5374333 – Alex Herman Oct 15 '18 at 18:48

0 Answers0