Skip to content

Commit 0809707

Browse files
committed
fix(pkce): retrieve code challenge and method from either body or query
1 parent a21cfcc commit 0809707

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
@@ -376,7 +376,7 @@ AuthorizeHandler.prototype.updateResponse = function(response, redirectUri, stat
376376
};
377377

378378
AuthorizeHandler.prototype.getCodeChallenge = function(request) {
379-
return request.body.code_challenge;
379+
return request.body.code_challenge || request.query.code_challenge;
380380
};
381381

382382
/**
@@ -387,7 +387,7 @@ AuthorizeHandler.prototype.getCodeChallenge = function(request) {
387387
* (see https://www.rfc-editor.org/rfc/rfc7636#section-4.4)
388388
*/
389389
AuthorizeHandler.prototype.getCodeChallengeMethod = function(request) {
390-
const algorithm = request.body.code_challenge_method;
390+
const algorithm = request.body.code_challenge_method || request.query.code_challenge_method;
391391

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

0 commit comments

Comments
 (0)