diff --git a/packages/authentication-local/test/fixture.js b/packages/authentication-local/test/fixture.js index 7772bcdc1a..acbc34d765 100644 --- a/packages/authentication-local/test/fixture.js +++ b/packages/authentication-local/test/fixture.js @@ -13,6 +13,7 @@ module.exports = (app = feathers()) => { service: 'users', secret: 'supersecret', authStrategies: [ 'local', 'jwt' ], + parseStrategies: [ 'jwt' ], local: { usernameField: 'email', passwordField: 'password' diff --git a/packages/express/lib/authentication.js b/packages/express/lib/authentication.js index fc7276bf6b..991574f4c3 100644 --- a/packages/express/lib/authentication.js +++ b/packages/express/lib/authentication.js @@ -15,10 +15,11 @@ exports.parseAuthentication = (settings = {}) => { return next(); } - const { authStrategies = [] } = service.configuration; + const config = service.configuration; + const authStrategies = config.parseStrategies || config.authStrategies || []; if (authStrategies.length === 0) { - debug('No `authStrategies` found in authentication configuration'); + debug('No `authStrategies` or `parseStrategies` found in authentication configuration'); return next(); } diff --git a/packages/express/test/authentication.test.js b/packages/express/test/authentication.test.js index 6121413e1d..a96ba63d83 100644 --- a/packages/express/test/authentication.test.js +++ b/packages/express/test/authentication.test.js @@ -116,9 +116,10 @@ describe('@feathersjs/express/authentication', () => { }); }); - it('errors when there are no authStrategies', () => { + it('errors when there are no authStrategies and parseStrategies', () => { const { accessToken } = authResult; app.get('authentication').authStrategies = []; + delete app.get('authentication').parseStrategies; return axios.get('/dummy/dave', { headers: { diff --git a/packages/socketio/lib/middleware.js b/packages/socketio/lib/middleware.js index 1cbf289cbb..10f626621f 100644 --- a/packages/socketio/lib/middleware.js +++ b/packages/socketio/lib/middleware.js @@ -23,7 +23,8 @@ exports.authentication = (app, getParams, settings = {}) => (socket, next) => { return next(); } - const { authStrategies = [] } = service.configuration; + const config = service.configuration; + const authStrategies = config.parseStrategies || config.authStrategies || []; if (authStrategies.length === 0) { return next();