Skip to content

Commit cc643fe

Browse files
authored
fix(pkce): get code_challenge and _method from query if not present in body
Merge pull request #197 from node-oauth/fix-pkce-missing-query
2 parents 9b68723 + 8dd11fe commit cc643fe

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
@@ -369,7 +369,7 @@ AuthorizeHandler.prototype.updateResponse = function(response, redirectUri, stat
369369
};
370370

371371
AuthorizeHandler.prototype.getCodeChallenge = function(request) {
372-
return request.body.code_challenge;
372+
return request.body.code_challenge || request.query.code_challenge;
373373
};
374374

375375
/**
@@ -380,7 +380,7 @@ AuthorizeHandler.prototype.getCodeChallenge = function(request) {
380380
* (see https://www.rfc-editor.org/rfc/rfc7636#section-4.4)
381381
*/
382382
AuthorizeHandler.prototype.getCodeChallengeMethod = function(request) {
383-
const algorithm = request.body.code_challenge_method;
383+
const algorithm = request.body.code_challenge_method || request.query.code_challenge_method;
384384

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

0 commit comments

Comments
 (0)