Skip to content

Commit

Permalink
Get code_challenge and _method from query if not present in body
Browse files Browse the repository at this point in the history
Reintroduce PR node-oauth#197 fix
  • Loading branch information
mthlemos authored Oct 31, 2023
1 parent b97f6c7 commit c1d8610
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/handlers/authorize-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class AuthorizeHandler {
}

getCodeChallenge (request) {
return request.body.code_challenge;
return request.body.code_challenge || request.query.code_challenge;
}

/**
Expand All @@ -378,7 +378,7 @@ class AuthorizeHandler {
* (see https://www.rfc-editor.org/rfc/rfc7636#section-4.4)
*/
getCodeChallengeMethod (request) {
const algorithm = request.body.code_challenge_method;
const algorithm = request.body.code_challenge_method || request.query.code_challenge_method;

if (algorithm && !pkce.isValidMethod(algorithm)) {
throw new InvalidRequestError(`Invalid request: transform algorithm '${algorithm}' not supported`);
Expand Down

0 comments on commit c1d8610

Please sign in to comment.