diff --git a/lib/exchange/authorizationCode.js b/lib/exchange/authorizationCode.js index 6071e630..38fcf930 100644 --- a/lib/exchange/authorizationCode.js +++ b/lib/exchange/authorizationCode.js @@ -67,7 +67,7 @@ module.exports = function(options, issue) { var userProperty = options.userProperty || 'user'; return function authorization_code(req, res, next) { - if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget body-parser middleware ?')); } // The 'user' property of `req` holds the authenticated user. In the case // of the token endpoint, the property will contain the OAuth 2.0 client. diff --git a/lib/exchange/clientCredentials.js b/lib/exchange/clientCredentials.js index 59032f36..b7576ff5 100644 --- a/lib/exchange/clientCredentials.js +++ b/lib/exchange/clientCredentials.js @@ -76,7 +76,7 @@ module.exports = function(options, issue) { } return function client_credentials(req, res, next) { - if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget body-parser middleware ?')); } // The 'user' property of `req` holds the authenticated user. In the case // of the token endpoint, the property will contain the OAuth 2.0 client. diff --git a/lib/exchange/password.js b/lib/exchange/password.js index f38ff3ea..4ed8599b 100644 --- a/lib/exchange/password.js +++ b/lib/exchange/password.js @@ -77,7 +77,7 @@ module.exports = function(options, issue) { } return function password(req, res, next) { - if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget body-parser middleware ?')); } // The 'user' property of `req` holds the authenticated user. In the case // of the token endpoint, the property will contain the OAuth 2.0 client. diff --git a/lib/exchange/refreshToken.js b/lib/exchange/refreshToken.js index 616c097d..00ae22cb 100644 --- a/lib/exchange/refreshToken.js +++ b/lib/exchange/refreshToken.js @@ -74,7 +74,7 @@ module.exports = function(options, issue) { } return function refresh_token(req, res, next) { - if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget body-parser middleware ?')); } // The 'user' property of `req` holds the authenticated user. In the case // of the token endpoint, the property will contain the OAuth 2.0 client. diff --git a/lib/middleware/authorization.js b/lib/middleware/authorization.js index 91e91c3f..97c6c541 100644 --- a/lib/middleware/authorization.js +++ b/lib/middleware/authorization.js @@ -112,7 +112,7 @@ module.exports = function(server, options, validate, immediate) { , key = options.sessionKey || 'authorize'; return function authorization(req, res, next) { - if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget app.use(express.session(...))?')); } + if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget session middleware ?')); } var body = req.body || {} , type = req.query.response_type || body.response_type; diff --git a/lib/middleware/decision.js b/lib/middleware/decision.js index 2dcdfa12..781614c7 100644 --- a/lib/middleware/decision.js +++ b/lib/middleware/decision.js @@ -80,8 +80,8 @@ module.exports = function(server, options, parse) { , key = options.sessionKey || 'authorize'; return function decision(req, res, next) { - if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget app.use(express.session(...))?')); } - if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?')); } + if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget session middleware ?')); } + if (!req.body) { return next(new Error('OAuth2orize requires body parsing. Did you forget body-parser middleware ?')); } if (!req.oauth2) { return next(new Error('OAuth2orize requires transaction support. Did you forget oauth2orize.transactionLoader(...)?')); } if (!req.session[key]) { return next(new ForbiddenError('Unable to load OAuth 2.0 transactions from session')); } diff --git a/lib/middleware/transactionLoader.js b/lib/middleware/transactionLoader.js index 4a7c7345..644efb92 100644 --- a/lib/middleware/transactionLoader.js +++ b/lib/middleware/transactionLoader.js @@ -33,7 +33,7 @@ module.exports = function(server, options) { , key = options.sessionKey || 'authorize'; return function transactionLoader(req, res, next) { - if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget app.use(express.session(...))?')); } + if (!req.session) { return next(new Error('OAuth2orize requires session support. Did you forget session middleware ?')); } if (!req.session[key]) { return next(new ForbiddenError('Unable to load OAuth 2.0 transactions from session')); } var query = req.query || {} diff --git a/test/exchange/authorizationCode.test.js b/test/exchange/authorizationCode.test.js index 5668eec4..2b6f568b 100644 --- a/test/exchange/authorizationCode.test.js +++ b/test/exchange/authorizationCode.test.js @@ -279,7 +279,7 @@ describe('exchange.authorizationCode', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?'); + expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget body-parser middleware ?'); }); }); diff --git a/test/exchange/clientCredentials.test.js b/test/exchange/clientCredentials.test.js index 87bd7477..10839178 100644 --- a/test/exchange/clientCredentials.test.js +++ b/test/exchange/clientCredentials.test.js @@ -322,7 +322,7 @@ describe('exchange.clientCredentials', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?'); + expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget body-parser middleware ?'); }); }); diff --git a/test/exchange/password.test.js b/test/exchange/password.test.js index c0d0199b..ebdb3244 100644 --- a/test/exchange/password.test.js +++ b/test/exchange/password.test.js @@ -374,7 +374,7 @@ describe('exchange.password', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?'); + expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget body-parser middleware ?'); }); }); diff --git a/test/exchange/refreshToken.test.js b/test/exchange/refreshToken.test.js index 382bf992..375acd2d 100644 --- a/test/exchange/refreshToken.test.js +++ b/test/exchange/refreshToken.test.js @@ -349,7 +349,7 @@ describe('exchange.refreshToken', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?'); + expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget body-parser middleware ?'); }); }); diff --git a/test/middleware/authorization.test.js b/test/middleware/authorization.test.js index fa8c65f9..fb971d7a 100644 --- a/test/middleware/authorization.test.js +++ b/test/middleware/authorization.test.js @@ -362,7 +362,7 @@ describe('authorization', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires session support. Did you forget app.use(express.session(...))?'); + expect(err.message).to.equal('OAuth2orize requires session support. Did you forget session middleware ?'); }); it('should not start transaction', function() { diff --git a/test/middleware/decision.test.js b/test/middleware/decision.test.js index 5f82097b..04b9c9b8 100644 --- a/test/middleware/decision.test.js +++ b/test/middleware/decision.test.js @@ -258,7 +258,7 @@ describe('decision', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires session support. Did you forget app.use(express.session(...))?'); + expect(err.message).to.equal('OAuth2orize requires session support. Did you forget session middleware ?'); }); it('should not set user on transaction', function() { @@ -297,7 +297,7 @@ describe('decision', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget app.use(express.bodyParser())?'); + expect(err.message).to.equal('OAuth2orize requires body parsing. Did you forget body-parser middleware ?'); }); it('should not set user on transaction', function() { diff --git a/test/middleware/transactionLoader.test.js b/test/middleware/transactionLoader.test.js index b286cda4..13008ee7 100644 --- a/test/middleware/transactionLoader.test.js +++ b/test/middleware/transactionLoader.test.js @@ -287,7 +287,7 @@ describe('transactionLoader', function() { it('should error', function() { expect(err).to.be.an.instanceOf(Error); - expect(err.message).to.equal('OAuth2orize requires session support. Did you forget app.use(express.session(...))?'); + expect(err.message).to.equal('OAuth2orize requires session support. Did you forget session middleware ?'); }); it('should not restore transaction', function() {