diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 2c780a330..6ece5e71e 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -815,10 +815,13 @@ def load_oauth_providers(): # Always register Letta OAuth provider (this is a Letta-focused deployment) def letta_oauth_register(oauth: OAuth): # Letta returns token_type: "access_token" instead of "Bearer", fix it - def letta_compliance_fix(client, token): - if token.get("token_type") == "access_token": - token["token_type"] = "Bearer" - return token + def letta_compliance_fix(session): + def _fix_token_response(response): + data = response.json() + if data.get("token_type") == "access_token": + data["token_type"] = "Bearer" + return data + session.register_compliance_hook("access_token_response", _fix_token_response) client = oauth.register( name="letta",