8000 fix(authentication-oauth): Fix bug introduced by PR #2631 by cciocov · Pull Request #2659 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extensi 8000 on

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
0