Skip to content

Commit 55c70da

Browse files
committed
Error respoonse
1 parent e87381d commit 55c70da

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import waffle
77
from waffle import get_waffle_flag_model
88

9-
from django.http.response import HttpResponse, HttpResponseBadRequest, JsonResponse
9+
from django.http.response import HttpResponse, HttpResponseBadRequest
1010
from django.template.response import TemplateResponse
1111
from django.utils.decorators import method_decorator
1212
from django.views.decorators.csrf import csrf_exempt
@@ -21,7 +21,6 @@
2121
)
2222
from oauth2_provider.models import get_application_model
2323
from oauthlib.oauth2.rfc6749.errors import InvalidClientError, InvalidGrantError
24-
from rest_framework import status as http_status
2524
from urllib.parse import urlparse, parse_qs
2625
import html
2726
from apps.dot_ext.scopes import CapabilitiesScopes
@@ -189,7 +188,7 @@ def form_valid(self, form):
189188
sender=self,
190189
request=self.request,
191190
auth_status="FAIL",
192-
auth_status_code=http_status.HTTP_400_BAD_REQUEST,
191+
auth_status_code=302,
193192
user=self.request.user,
194193
application=application,
195194
share_demographic_scopes=share_demographic_scopes,
@@ -198,7 +197,7 @@ def form_valid(self, form):
198197
access_token_delete_cnt=access_token_delete_cnt,
199198
refresh_token_delete_cnt=refresh_token_delete_cnt,
200199
data_access_grant_delete_cnt=data_access_grant_delete_cnt)
201-
return JsonResponse({"error": 'Requested scopes denied'}, status=http_status.HTTP_400_BAD_REQUEST)
200+
return self.error_response('Requested scopes denied', application)
202201
try:
203202
uri, headers, body, status = self.create_authorization_response(
204203
request=self.request, scopes=scopes, credentials=credentials, allow=allow

0 commit comments

Comments
 (0)