question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTPBearer security scheme is returning 403 instead or 401

See original GitHub issue

HTTPBearer security scheme enabled as a dependency is returning a 403 when a request is unauthenticated because of a missing or a malformed authorization header. In those scenarios, a 401 should be returned instead.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
dorinclisucommented, Feb 8, 2021

It makes total sense to have 401 returned, I’m sure tiangolo did not mean 403 and it was just a small mishap

7reactions
iantimmiscommented, Mar 30, 2022

This is still not fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Forbidden (403), Unauthorized (401), or What Else? - Auth0
403 Forbidden is the status code to return when a client has valid credentials but not enough privileges to perform an action on...
Read more >
Spring Security Returns with 403 when there is no Bearer token
But when tested with different scenario it is found that spring security returns with 403 instead of 401 if there is no Authorization...
Read more >
HTTP Basic Auth - FastAPI
If it doesn't receive it, it returns an HTTP 401 "Unauthorized" error. ... Create a " security scheme" using HTTPBasic . Use that...
Read more >
HTTP authentication - MDN Web Docs - Mozilla
The server responds to a client with a 401 (Unauthorized) response status ... The "Basic" authentication scheme offers very poor security, ...
Read more >
TDD Approach to Create an Authentication System With ...
It returns a status code of 403 in return. This happens because we don't have the Bearer token in the Authorization header. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found