Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/quartz_api/internal/middleware/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ async def _proxy_dependency(
try:
claims = await validator_dependency(request)
except HTTPException as e:
if (
e.status_code == 400 and
isinstance(e.detail, dict) and
e.detail.get("error") == "invalid_request"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is does invalid_request appear if and only if when the user is not authenticated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes only when not authenticated, or missing token (i checked in the library code itself in the venv, as there is no docs for this)

):
# override to 403 if its an Auth0 invalid_request error
raise HTTPException(status_code=403, detail=e.detail) from e

if e.status_code == 403:
log.info(f"Unauthorized access attempt: {e.detail}")

Expand Down