fix: normalize OIDC issuer URL to avoid double slashes
The OIDC issuer URL in .env ends with a trailing slash, which caused the authorize endpoint to have a double slash (//authorize). - Normalize issuer URL by removing trailing slash before appending path - Applied to both LoginPage.tsx and CallbackPage.tsx - Fixes Authentik 'not found' error on login redirect
This commit is contained in:
@@ -35,7 +35,8 @@ export default function CallbackPage() {
|
|||||||
|
|
||||||
setStatus('Exchanging code for token...')
|
setStatus('Exchanging code for token...')
|
||||||
|
|
||||||
const tokenResponse = await fetch(`${OIDC_ISSUER}/token/`, {
|
const issuer = OIDC_ISSUER.endsWith('/') ? OIDC_ISSUER.slice(0, -1) : OIDC_ISSUER
|
||||||
|
const tokenResponse = await fetch(`${issuer}/token/`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ export default function LoginPage() {
|
|||||||
code_challenge_method: 'S256',
|
code_challenge_method: 'S256',
|
||||||
})
|
})
|
||||||
|
|
||||||
window.location.href = `${OIDC_ISSUER}/authorize?${params.toString()}`
|
const issuer = OIDC_ISSUER.endsWith('/') ? OIDC_ISSUER.slice(0, -1) : OIDC_ISSUER
|
||||||
|
window.location.href = `${issuer}/authorize?${params.toString()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
initiateLogin()
|
initiateLogin()
|
||||||
|
|||||||
Reference in New Issue
Block a user