diff --git a/packages/authentication-oauth/src/strategy.ts b/packages/authentication-oauth/src/strategy.ts index fb2d4e700c..2904dd949f 100644 --- a/packages/authentication-oauth/src/strategy.ts +++ b/packages/authentication-oauth/src/strategy.ts @@ -16,13 +16,14 @@ export interface OAuthProfile { export class OAuthStrategy extends AuthenticationBaseStrategy { get configuration () { - const { entity, service, entityId } = this.authentication.configuration; + const { entity, service, entityId, oauth } = this.authentication.configuration; + const config = oauth[this.name]; return { entity, service, entityId, - ...super.configuration + ...config }; } diff --git a/packages/authentication-oauth/test/strategy.test.ts b/packages/authentication-oauth/test/strategy.test.ts index 19d924ff24..cc529865a4 100644 --- a/packages/authentication-oauth/test/strategy.test.ts +++ b/packages/authentication-oauth/test/strategy.test.ts @@ -12,6 +12,12 @@ describe('@feathersjs/authentication-oauth/strategy', () => { assert.ok(strategy.configuration.entity); }); + it('reads configuration from the oauth key', () => { + const testConfigValue = Math.random() + app.get('authentication').oauth.test.hello = testConfigValue + assert.strictEqual(strategy.configuration.hello, testConfigValue) + }); + it('getRedirect', async () => { app.get('authentication').oauth.redirect = '/home';