66import waffle
77from waffle import get_waffle_flag_model
88
9- from django .http .response import HttpResponse , HttpResponseBadRequest , JsonResponse
9+ from django .http .response import HttpResponse , HttpResponseBadRequest
1010from django .template .response import TemplateResponse
1111from django .utils .decorators import method_decorator
1212from django .views .decorators .csrf import csrf_exempt
2121)
2222from oauth2_provider .models import get_application_model
2323from oauthlib .oauth2 .rfc6749 .errors import InvalidClientError , InvalidGrantError
24- from rest_framework import status as http_status
2524from urllib .parse import urlparse , parse_qs
2625import html
2726from 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