1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

200 status Postman request, but 401 when requesting from the browser

Discussão em 'Angular' iniciado por Volvo, Outubro 15, 2024.

  1. Volvo

    Volvo Guest

    I have a frustrating problem with my API call (Asp.Net WebAPI and Angular). I use bearer token authorization to authorize the requests. When I make a request to the API from Postman it returns 200 Ok but when I try it from the browser (Angular) I get 401 Unauthorized.

    I can get it working if I use [AllowAnonymous] attribute on top of the controller action but I'd like to keep the [Authorize] attribute for the security reasons.

    I'm not sure what's causing this error. Here is the screenshot of the request headers from the browser. As you can see it includes the valid bearer token as well. The funny thing is that the Authorize attribute works for the other actions in my controller.

    https://i.sstatic.net/K5OB1.png

    Thank you in advance.

    Continue reading...

Compartilhe esta Página