Skip to content

Commit 3c6ffeb

Browse files
Fix ui host for oauth
1 parent a75e118 commit 3c6ffeb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/core/contentstackHTTPClient.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,16 @@ export default function contentstackHttpClient (options) {
7777
}
7878
}
7979

80-
const uiHostName = getRegionEndpoint(region, 'application')
81-
82-
let developerHubBaseUrl
80+
let uiHostName, developerHubBaseUrl
8381
if (config.host && (config.host.startsWith('dev') || config.host.startsWith('stag'))) {
84-
developerHubBaseUrl = config.host
85-
.replace('api', 'developerhub-api')
82+
const transformedHost = config.host
8683
.replace(/^dev\d+/, 'dev')
8784
.replace(/^stag\d+/, 'stag')
88-
.replace(/^http:\/\//, '')
89-
.replace(/^https:\/\//, '')
90-
.replace(/^/, 'https://')
85+
uiHostName = transformedHost.replace('-api.', '-app.')
86+
developerHubBaseUrl = `https://${transformedHost.replace('-api.', '-developerhub-api.')}`
9187
} else {
92-
developerHubBaseUrl = getRegionEndpoint(region, 'developerHub').replace(/^/, 'https://')
88+
uiHostName = getRegionEndpoint(region, 'application')
89+
developerHubBaseUrl = `https://${getRegionEndpoint(region, 'developerHub')}`
9390
}
9491

9592
const uiBaseUrl = config.endpoint || `${protocol}://${uiHostName}`

0 commit comments

Comments
 (0)