open-webui/backend/open_webui
Claude db173da216
fix: renew non-refreshable OAuth tokens instead of deleting the session
Addresses review feedback on #26802: even after stamping a long-lived
expiry, _perform_token_refresh still returned None for tokens without a
refresh_token, so get_oauth_token would delete the session once that
expiry elapsed — reproducing the original bug a year later instead of
hourly.

Flag tokens that carry neither expiry metadata nor a refresh_token with
NON_REFRESHABLE_TOKEN_MARKER in _normalize_token_expiry. When such a
token reaches the refresh path, _renew_non_refreshable_token re-stamps
its local expiry in place and returns it, so the session keeps renewing
itself (Slack xoxp user tokens never expire and never rotate). Tokens
with a real provider-declared expiry but no refresh token are not
flagged and remain untouched: they still expire and require re-auth.

Also fixes the Ruff format failure on the branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKLX4jqe4E868Zr43ZmzVC
2026-07-09 09:31:05 +00:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-06-29 12:40:20 -05:00
migrations refac 2026-07-01 03:37:35 -05:00
models refac 2026-07-01 03:01:46 -05:00
retrieval refac 2026-07-01 02:20:16 -05:00
routers refac 2026-07-01 03:37:35 -05:00
socket refac 2026-06-29 03:58:00 -05:00
static chore: format 2026-06-01 14:10:40 -07:00
storage refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
tools refac 2026-07-01 03:35:46 -05:00
utils fix: renew non-refreshable OAuth tokens instead of deleting the session 2026-07-09 09:31:05 +00:00
__init__.py refac 2026-06-17 03:01:11 +02:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-07-01 02:26:47 -05:00
constants.py refac 2026-06-29 05:46:51 -05:00
env.py refac 2026-07-01 02:59:14 -05:00
events.py refac 2026-07-01 03:22:13 -05:00
functions.py fix: emit [DONE] for AsyncGenerator pipe returns (#24763) 2026-05-19 22:07:56 +04:00
main.py refac 2026-07-01 03:37:35 -05:00
tasks.py refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00