This commit is contained in:
Timothy Jaeryang Baek
2026-06-01 13:38:40 -07:00
parent 33e4e0dcc4
commit c8eb8edca4
2 changed files with 16 additions and 0 deletions
+4
View File
@@ -3042,6 +3042,10 @@ async def get_system_oauth_token(request, user):
from open_webui.models.oauth_sessions import OAuthSessions
sessions = await OAuthSessions.get_sessions_by_user_id(user.id)
# Filter out MCP-provider sessions — their token refresh is handled
# separately by oauth_client_manager. Passing them to the SSO
# oauth_manager causes a failed refresh and session deletion (#24618).
sessions = [s for s in sessions if not (s.provider or '').startswith('mcp:')]
if sessions:
best = max(sessions, key=lambda s: s.updated_at)
oauth_token = await request.app.state.oauth_manager.get_oauth_token(