🐛 Use 401 status code in security classes when credentials are missing (#13786)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-11-24 20:03:06 +01:00
1 parent e2354a0a06
commit 51ad909ffe
36 files changed
+315 -116

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ async def get_current_user(token: str = Depends(oauth2_scheme)):
if not user:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid authentication credentials",
detail="Not authenticated",
headers={"WWW-Authenticate": "Bearer"},
)
return user