Skip to content

Commit

Permalink
Auth error: return dict with 'detail' key instead of 'error'
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Sep 6, 2024
1 parent e90ea08 commit 830d92f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions open_prices/api/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def post(self, request: Request) -> Response:
"""
if not settings.OAUTH2_SERVER_URL:
return Response(
{"error": "OAUTH2_SERVER_URL environment variable missing"},
{"detail": "OAUTH2_SERVER_URL environment variable missing"},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)
# By specifying body=1, information about the user is returned in the
Expand All @@ -70,12 +70,12 @@ def post(self, request: Request) -> Response:
elif response.status_code == 403:
time.sleep(2) # prevents brute-force
return Response(
{"error": "Invalid authentication credentials"},
{"detail": "Invalid authentication credentials"},
status=status.HTTP_401_UNAUTHORIZED,
headers={"WWW-Authenticate": "Bearer"},
)
raise Response(
{"error": "Server error"},
{"detail": "Server error"},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)

Expand Down

0 comments on commit 830d92f

Please sign in to comment.