fix: make refresh_token optional in OIDC token exchange

Authentik may not return a refresh_token in the authorization_code
response. Use .get() instead of direct dict access to prevent KeyError.
This commit is contained in:
Fusion
2026-05-18 21:41:13 +02:00
parent 3cd8674c31
commit 137757602f
+1 -1
View File
@@ -47,7 +47,7 @@ async def exchange_code_for_tokens(
payload = response.json()
return {
"access_token": payload["access_token"],
"refresh_token": payload["refresh_token"],
"refresh_token": payload.get("refresh_token"),
}