mirror of
https://github.com/tale/headplane.git
synced 2026-08-28 07:57:03 +00:00
fix: build oidc callback url in a more proper way (#28)
This commit is contained in:
+4
-4
@@ -51,8 +51,8 @@ export async function startOidc(oidc: OidcConfig, req: Request) {
|
|||||||
const challenge = await calculatePKCECodeChallenge(verifier)
|
const challenge = await calculatePKCECodeChallenge(verifier)
|
||||||
|
|
||||||
const callback = new URL('/admin/oidc/callback', req.url)
|
const callback = new URL('/admin/oidc/callback', req.url)
|
||||||
callback.protocol = req.url.includes('localhost') ? 'http:' : 'https:'
|
callback.protocol = req.headers.get('X-Forwarded-Proto') ?? 'http:'
|
||||||
callback.hostname = req.headers.get('Host') ?? ''
|
callback.host = req.headers.get('Host') ?? ''
|
||||||
const authUrl = new URL(processed.authorization_endpoint)
|
const authUrl = new URL(processed.authorization_endpoint)
|
||||||
|
|
||||||
authUrl.searchParams.set('client_id', oidcClient.client_id)
|
authUrl.searchParams.set('client_id', oidcClient.client_id)
|
||||||
@@ -119,8 +119,8 @@ export async function finishOidc(oidc: OidcConfig, req: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const callback = new URL('/admin/oidc/callback', req.url)
|
const callback = new URL('/admin/oidc/callback', req.url)
|
||||||
callback.protocol = req.url.includes('localhost') ? 'http:' : 'https:'
|
callback.protocol = req.headers.get('X-Forwarded-Proto') ?? 'http:'
|
||||||
callback.hostname = req.headers.get('Host') ?? ''
|
callback.host = req.headers.get('Host') ?? ''
|
||||||
|
|
||||||
const tokenResponse = await authorizationCodeGrantRequest(
|
const tokenResponse = await authorizationCodeGrantRequest(
|
||||||
processed,
|
processed,
|
||||||
|
|||||||
Reference in New Issue
Block a user