mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #23669] Bug: OAuth session stores expires_at=None when token response omits expires_in, disabling refresh #58707
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 @dhruvalgupta2003 on GitHub (Apr 13, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23669
Summary
On the OAuth callback,
expires_atis derived fromexpires_in:If the token response lacks
expires_in(some providers return onlyexpires_at, or omit expiration entirely for certain grant types),expires_atis never populated. The session is then persisted withexpires_at=None:Impact
get_oauth_tokencannot evaluatedatetime.fromtimestamp(session.expires_at)when it'sNone, causing either a TypeError or a silent skip.Location
backend/open_webui/utils/oauth.py~ lines 881–882 (callback normalisation)backend/open_webui/models/oauth_sessions.py~ line 125 (persistence)backend/open_webui/utils/oauth.py~ line 706 (proactive-refresh check)Suggested fix
expires_atdirectly, trust it.expires_innorexpires_atis present, either (a) fall back to a conservative default (e.g. 1 hour) and log a warning, or (b) always attempt a silent refresh before using the token, and surface a clear re-auth error if refresh fails.Noneso it never throws.@tjbck commented on GitHub (Apr 13, 2026):
Addressed in dev.
@dhruval-gupta commented on GitHub (Apr 13, 2026):
i saw that but i am using dev docker image but due to client id and other issues with static oauth2.1 i cannot fully test it e2e.