From ba701f8620ffe3003469346d8cae197ab273e526 Mon Sep 17 00:00:00 2001 From: Catalin Ciocov Date: Tue, 7 Jun 2022 23:05:44 +0300 Subject: [PATCH 1/3] fix(authentication-oauth): Fix bug introduced by PR #2631 --- packages/authentication-oauth/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/authentication-oauth/src/index.ts b/packages/authentication-oauth/src/index.ts index 3474f7ed33..6698c2d7d5 100644 --- a/packages/authentication-oauth/src/index.ts +++ b/packages/authentication-oauth/src/index.ts @@ -44,6 +44,8 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { } const grant = defaultsDeep( + {}, + omit(oauth, ['redirect', 'origins']), { defaults: { prefix, @@ -51,8 +53,7 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { transport: oauth?.defaults?.transport ?? 'session', response: ['tokens', 'raw', 'profile'] } - }, - omit(oauth, ['redirect', 'origins']) + } ) const getUrl = (url: string) => { From e6ee75c413f8f218841dfc90569b74ee76cbeb15 Mon Sep 17 00:00:00 2001 From: Catalin Ciocov Date: Wed, 8 Jun 2022 08:16:50 +0300 Subject: [PATCH 2/3] fix(authentication-oauth): Properly set Grant defaults --- packages/authentication-oauth/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/authentication-oauth/src/index.ts b/packages/authentication-oauth/src/index.ts index 6698c2d7d5..b13e7f0c3f 100644 --- a/packages/authentication-oauth/src/index.ts +++ b/packages/authentication-oauth/src/index.ts @@ -48,9 +48,9 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { omit(oauth, ['redirect', 'origins']), { defaults: { - prefix, - origin: `${oauth?.defaults?.protocol ?? protocol}://${oauth?.defaults?.host ?? host}`, - transport: oauth?.defaults?.transport ?? 'session', + prefix: '/oauth', + origin: `${protocol}://${host}`, + transport: 'session', response: ['tokens', 'raw', 'profile'] } } @@ -58,7 +58,7 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { const getUrl = (url: string) => { const { defaults } = grant - return `${defaults.origin}${prefix}/${url}` + return `${defaults.origin}${defaults.prefix}/${url}` } each(grant, (value, name) => { From b49fb845f663dfd521d1ca13e173a4192fd122d0 Mon Sep 17 00:00:00 2001 From: Catalin Ciocov Date: Wed, 8 Jun 2022 08:18:32 +0300 Subject: [PATCH 3/3] fix(authentication-oauth): Removed unused declaration --- packages/authentication-oauth/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/authentication-oauth/src/index.ts b/packages/authentication-oauth/src/index.ts index b13e7f0c3f..de15449b40 100644 --- a/packages/authentication-oauth/src/index.ts +++ b/packages/authentication-oauth/src/index.ts @@ -30,7 +30,6 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { const { strategyNames } = service // Set up all the defaults - const { prefix = '/oauth' } = oauth.defaults || {} const port = app.get('port') let host = app.get('host') let protocol = 'https'