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

3
  • Possible duplicate of Best HTTP Authorization header type for JWT Commented Jul 7, 2017 at 18:59
  • No. I want to use role base authentication and authorization like i want to use [Authorize(Role="Admin")] Commented Jul 10, 2017 at 9:30
  • Strange, I don't have to use Bearer keyword and it all works fine for me. See my answer stackoverflow.com/a/52822924/5374333 Commented Oct 15, 2018 at 18:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.