From c440f5aa1e2546f2b2b1b410cb0921590f2c8394 Mon Sep 17 00:00:00 2001 From: Mabe Date: Sun, 21 Jun 2026 17:14:19 +0200 Subject: [PATCH] fix: update token retrieval logic in handleRedirectCallback and remove unused parseSSE function --- backend/app/auth.py | 2 +- frontend/src/App.tsx | 22 ++++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/backend/app/auth.py b/backend/app/auth.py index 25fcf64..69a468f 100644 --- a/backend/app/auth.py +++ b/backend/app/auth.py @@ -89,7 +89,7 @@ async def validate_token(credentials: HTTPAuthorizationCredentials = Security(se # `OIDC_AUDIENCE` unset and the audience check will be skipped. jwt_kwargs = { "algorithms": [key.get("alg", "RS256")], - "issuer": str(settings.oidc_issuer) if settings.oidc_verify_iss else None, + "issuer": discovery.get("issuer") if settings.oidc_verify_iss else None, } if settings.oidc_audience: jwt_kwargs["audience"] = settings.oidc_audience diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 46c6000..0ea91cd 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -165,29 +165,15 @@ async function handleRedirectCallback(): Promise { }) const result = await response.json() - if (response.ok && result.access_token) { - setLocalToken(result.access_token) - return result.access_token + const token = result.id_token || result.access_token + if (response.ok && token) { + setLocalToken(token) + return token } throw new Error(result.error_description || 'OIDC callback failed') } -function parseSSE(text: string, onData: (chunk: string) => void) { - const events = text.split('\n\n') - for (const event of events) { - const trimmed = event.trim() - if (!trimmed) continue - const lines = trimmed.split('\n') - const dataLines = lines - .filter((line) => line.startsWith('data:')) - .map((line) => line.replace(/^data:\s?/, '')) - if (dataLines.length) { - onData(dataLines.join('\n')) - } - } -} - function App() { const [messages, setMessages] = useState([]) const [input, setInput] = useState('')