Set status 400 on oauth exceptions
authorMagnus Hagander <magnus@hagander.net>
Wed, 11 Jun 2025 18:47:16 +0000 (20:47 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 11 Jun 2025 18:47:16 +0000 (20:47 +0200)
It's not always entirely correct, but it's less wrong than 200.

pgweb/account/oauthclient.py

index 8398cbe0d81d2f193276228feb96de7b626556dc..283e5621ca752056ae732fef37df2f86593b2c34 100644 (file)
@@ -372,7 +372,7 @@ def _oauth_login_dispatch(provider, request):
         try:
             return getattr(m, fn)(request)
         except OAuthException as e:
-            return HttpResponse(e)
+            return HttpResponse(e, status=400)
         except Exception as e:
             log.error('Exception during OAuth: {}'.format(e))
             return HttpResponse('An unhandled exception occurred during the authentication process')