diff --git a/packages/authentication-oauth2/lib/index.js b/packages/authentication-oauth2/lib/index.js index 5c3d2a6abe..2e5e466fd1 100644 --- a/packages/authentication-oauth2/lib/index.js +++ b/packages/authentication-oauth2/lib/index.js @@ -21,7 +21,7 @@ const INCLUDE_KEYS = [ const EXCLUDE_KEYS = ['Verifier', 'Strategy', 'formatter']; -module.exports = function init (options = {}) { +function init (options = {}) { return function oauth2Auth () { const app = this; const _super = app.setup; @@ -99,9 +99,12 @@ module.exports = function init (options = {}) { return result; }; }; -}; +} + +module.exports = init; // Exposed Modules Object.assign(module.exports, { + default: init, Verifier: DefaultVerifier }); diff --git a/packages/authentication-oauth2/test/index.test.js b/packages/authentication-oauth2/test/index.test.js index 5b821a4614..9343675973 100644 --- a/packages/authentication-oauth2/test/index.test.js +++ b/packages/authentication-oauth2/test/index.test.js @@ -20,6 +20,10 @@ describe('@feathersjs/authentication-oauth2', () => { expect(typeof require('../lib')).to.equal('function'); }); + it('exports default', () => { + expect(oauth2.default).to.equal(oauth2); + }); + it('basic functionality', () => { expect(typeof oauth2).to.equal('function'); });