Skip to content

Commit

Permalink
Read params from query or body.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Feb 24, 2023
1 parent 5fcd4c5 commit f894692
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ OAuth2Strategy.prototype.authenticate = function(req, options) {
callbackURL: callbackURL
}

if (req.query && req.query.code) {
if ((req.query && req.query.code) || (req.body && req.body.code)) {
function loaded(err, ok, state) {
if (err) { return self.error(err); }
if (!ok) {
return self.fail(state, 403);
}

var code = req.query.code;
var code = (req.query && req.query.code) || (req.body && req.body.code);

var params = self.tokenParams(options);
params.grant_type = 'authorization_code';
Expand Down Expand Up @@ -213,7 +213,7 @@ OAuth2Strategy.prototype.authenticate = function(req, options) {
);
}

var state = req.query.state;
var state = (req.query && req.query.state) || (req.body && req.body.state);
try {
var arity = this._stateStore.verify.length;
if (arity == 4) {
Expand Down

0 comments on commit f894692

Please sign in to comment.