Closed
Description
Describe the bug
code_challenge
and code_challenge_method
do not have value
s in AuthorizationView form. Parameters are given as GET parameters
/oauth/authorize/?client_id=xxx&response_type=code&code_challenge=xxx&code_challenge_method=S256&scope=xxx&redirect_uri=xxx
<form id="authorizationForm" method="post">
<h3 class="block-center-heading">Authorize PKCE?</h3>
<input type="hidden" name="csrfmiddlewaretoken" value="xxx">
<input type="hidden" name="redirect_uri" value="http://127.0.0.1:8000/success/" id="id_redirect_uri">
...
<input type="hidden" name="code_challenge" id="id_code_challenge">
<input type="hidden" name="code_challenge_method" id="id_code_challenge_method">
</form>
Expected behavior
<form id="authorizationForm" method="post">
<h3 class="block-center-heading">Authorize PKCE?</h3>
<input type="hidden" name="csrfmiddlewaretoken" value="xxx">
<input type="hidden" name="redirect_uri" value="http://127.0.0.1:8000/success/" id="id_redirect_uri">
...
<input type="hidden" name="code_challenge" value="xxxxx" id="id_code_challenge">
<input type="hidden" name="code_challenge_method" value="S256" id="id_code_challenge_method">
</form>
Version
django-oauth-toolkit 1.3.3
- I have tested with the latest published release and it's still a problem.
- I have tested with the master branch and it's still a problem.
Additional context
I fixed for my local project by 'returning' old code from 1.3.2
class CustomAuthorizationView(AuthorizationView):
def get(self, request, *args, **kwargs):
try:
scopes, credentials = self.validate_authorization_request(request)
credentials["code_challenge"] = credentials.get(
"code_challenge",
request.GET.get("code_challenge", None)
)
credentials["code_challenge_method"] = credentials.get(
"code_challenge_method",
request.GET.get("code_challenge_method", None)
)
except OAuthToolkitError as error:
# Application is not available at this time.
return self.error_response(error, application=None)
kwargs["code_challenge"] = credentials["code_challenge"]
kwargs["code_challenge_method"] = credentials["code_challenge_method"]
return super(CustomAuthorizationView, self).get(request, *args, **kwargs)