From d19c8bf26eea507e25eb7b6485aa5603f6ffa009 Mon Sep 17 00:00:00 2001 From: Karolis Narkevicius Date: Tue, 14 May 2019 02:55:25 +0100 Subject: [PATCH] fix: Correctly read the oauth strategy config (#1349) --- src/strategy.ts | 5 +++-- test/strategy.test.ts | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/strategy.ts b/src/strategy.ts index fb2d4e700c..2904dd949f 100644 --- a/src/strategy.ts +++ b/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/test/strategy.test.ts b/test/strategy.test.ts index 19d924ff24..cc529865a4 100644 --- a/test/strategy.test.ts +++ b/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';