From 1be83add64e31a9e1cde51d6fc02af5ce493a574 Mon Sep 17 00:00:00 2001 From: smichel17 Date: Wed, 4 Mar 2020 17:17:55 +0000 Subject: [PATCH] Error out on missing body in token middleware Currently it will just throw. --- lib/middleware/token.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/middleware/token.js b/lib/middleware/token.js index b4c526e8..def7c0c5 100644 --- a/lib/middleware/token.js +++ b/lib/middleware/token.js @@ -51,6 +51,7 @@ module.exports = function token(server, options) { if (!server) { throw new TypeError('oauth2orize.token middleware requires a server argument'); } return function token(req, res, next) { + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } var type = req.body.grant_type; server._exchange(type, req, res, function(err) {