fix: include BASE_PATH in OIDC redirect_uri for subpath deployments
Some checks failed
CI / cleanup-branch (push) Has been skipped
CI / build (push) Has started running
CI / docker (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / deploy-feature (push) Has been cancelled

Behind a reverse proxy with strip-prefix (e.g., Traefik at /server/),
the OIDC redirect_uri must include the prefix so the callback routes
back through the proxy. Now uses config.basePath (from <base href>)
instead of hardcoding '/'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-06 01:14:34 +02:00
parent 0fab20e67a
commit 5c4c7ad321
2 changed files with 4 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { type FormEvent, useEffect, useMemo, useState } from 'react';
import { Navigate } from 'react-router';
import { useAuthStore } from './auth-store';
import { api } from '../api/client';
import { config } from '../config';
import { Card, Input, Button, Alert, FormField } from '@cameleer/design-system';
import styles from './LoginPage.module.css';
@@ -69,7 +70,7 @@ export function LoginPage() {
const handleOidcLogin = () => {
if (!oidc) return;
setOidcLoading(true);
const redirectUri = `${window.location.origin}/oidc/callback`;
const redirectUri = `${window.location.origin}${config.basePath}oidc/callback`;
const params = new URLSearchParams({
response_type: 'code',
client_id: oidc.clientId,

View File

@@ -2,6 +2,7 @@ import { useEffect, useRef } from 'react';
import { Navigate, useNavigate } from 'react-router';
import { useAuthStore } from './auth-store';
import { Card, Spinner, Alert, Button } from '@cameleer/design-system';
import { config } from '../config';
export function OidcCallback() {
const { isAuthenticated, loading, error, loginWithOidcCode } = useAuthStore();
@@ -29,7 +30,7 @@ export function OidcCallback() {
return;
}
const redirectUri = `${window.location.origin}/oidc/callback`;
const redirectUri = `${window.location.origin}${config.basePath}oidc/callback`;
loginWithOidcCode(code, redirectUri);
}, [loginWithOidcCode]);