Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(authentication-oauth): Fix bug introduced by PR #2631 #2659

Merged
merged 3 commits into from
Jun 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/authentication-oauth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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) => {
Expand Down