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:
@@ -47,7 +47,7 @@ async def exchange_code_for_tokens(
|
|||||||
payload = response.json()
|
payload = response.json()
|
||||||
return {
|
return {
|
||||||
"access_token": payload["access_token"],
|
"access_token": payload["access_token"],
|
||||||
"refresh_token": payload["refresh_token"],
|
"refresh_token": payload.get("refresh_token"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user