Skip to content

Commit

Permalink
fix(pkce): get code challenge and method from either body or query (r…
Browse files Browse the repository at this point in the history
…edo #197)
  • Loading branch information
jankapunkt committed Nov 1, 2023
1 parent b97f6c7 commit ca43d4a
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 ca43d4a

Please sign in to comment.