mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #21647] bug: OAuth sessions deleted on re-login, breaking multi-device usage #35074
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gboston on GitHub (Feb 20, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21647
Description
Each OIDC login deletes all existing OAuth sessions for the same user+provider before creating a new one. This means logging in from a second device/browser invalidates the first device's session, causing tool calls to fail with "Missing Authorization header" until the user re-authenticates.
Steps to Reproduce
oauth_session_idcookie setsystem_oauthauthorizationoauth_sessionExpected Behavior
Multiple concurrent OIDC sessions should coexist. Logging in on Device B should not invalidate Device A's session.
Root Cause
In
backend/open_webui/utils/oauth.py, thehandle_callback()method inOAuthManager(around line 1682) deletes all existing sessions for the user+provider before creating a new one:The same pattern exists in
OAuthClientManager.handle_callback()(line 879-883) for MCP tool sessions.Why Refresh Doesn't Help
The OIDC token refresh mechanism works correctly — we confirmed sessions expired for up to 5 days are successfully refreshed using Okta's 7-day refresh token. The problem is that the session row is deleted, so
get_session_by_id_and_user_id()returnsNonebefore any refresh logic is reached.Architecture Already Supports Multi-Session
The rest of the codebase is already compatible with multiple concurrent sessions:
oauth_sessiontable has no unique constraint on(user_id, provider)— multiple rows per user/provider are validoauth_session_idcookie stores the session UUID, so each device naturally points to its own sessionget_session_by_id_and_user_id(session_id, user_id)— looks up by specific UUID, not by providerSuggested Fix
OAuthManager.handle_callback()for OIDC sessions (thefor session in sessionsblock)OAuthClientManager(MCP tool sessions) may reasonably keep the replace-on-reauth behavior since those tokens are typically one-per-providerEnvironment
mainbranch)@pr-validator-bot commented on GitHub (Feb 20, 2026):
⚠️ Missing Issue Title Prefix
@gboston, your issue title is missing a prefix (e.g.,
bug:,feat:,docs:).Please update your issue title to include one of the following prefixes:
Example:
bug: Login fails when using special characters in password@tjbck commented on GitHub (Feb 20, 2026):
ae05586fda