refac
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user