fix: update token retrieval logic in handleRedirectCallback and remove unused parseSSE function

This commit is contained in:
Mabe
2026-06-21 17:14:19 +02:00
parent fd453013fd
commit c440f5aa1e
2 changed files with 5 additions and 19 deletions
+1 -1
View File
@@ -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
+4 -18
View File
@@ -165,29 +165,15 @@ async function handleRedirectCallback(): Promise<string | null> {
})
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<Message[]>([])
const [input, setInput] = useState('')