diff --git a/packages/authentication-oauth/src/index.ts b/packages/authentication-oauth/src/index.ts index 3474f7ed33..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' @@ -44,20 +43,21 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { } const grant = defaultsDeep( + {}, + 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'] } - }, - omit(oauth, ['redirect', 'origins']) + } ) const getUrl = (url: string) => { const { defaults } = grant - return `${defaults.origin}${prefix}/${url}` + return `${defaults.origin}${defaults.prefix}/${url}` } each(grant, (value, name) => {