Skip to content

Commit ca43d4a

Browse files
committed
fix(pkce): get code challenge and method from either body or query (redo #197)
1 parent b97f6c7 commit ca43d4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/handlers/authorize-handler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class AuthorizeHandler {
367367
}
368368

369369
getCodeChallenge (request) {
370-
return request.body.code_challenge;
370+
return request.body.code_challenge || request.query.code_challenge;
371371
}
372372

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

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

0 commit comments

Comments
 (0)