open-webui/backend/open_webui/utils
root 0fe0fcff4d fix: Add proactive OAuth token refresh for MCP sessions
Add a background task that periodically refreshes OAuth tokens before
they expire, preventing users from having to re-authenticate when MCP
OAuth tokens (like Notion) expire after 1 hour.

Changes:
- Add get_expiring_sessions() method to OAuthSessionTable to query
  sessions expiring within a specified time window
- Enhance OAuthClientManager._perform_token_refresh() to handle
  unregistered MCP clients by discovering OAuth info from stored
  tool server config
- Add periodic_oauth_token_refresh() background task that runs every
  5 minutes and refreshes tokens expiring within 10 minutes
- Start the background task in app lifespan with proper cleanup

Fixes #19809
2025-12-08 18:29:07 +11:00
..
images feat: comfyui image edit support 2025-11-06 03:43:59 -05:00
mcp chore: format 2025-10-26 19:33:39 -07:00
telemetry enh/refac: deprecate USER_POOL 2025-11-28 07:39:02 -05:00
access_control.py feat: user list in channels 2025-11-25 04:38:07 -05:00
audit.py fix: audit 2025-12-01 10:59:01 -05:00
auth.py refac 2025-12-02 04:03:44 -05:00
channels.py feat: channel/thread @ model 2025-09-17 00:49:44 -05:00
chat.py refac/fix: direct connection floating action buttons 2025-10-02 02:21:21 -05:00
code_interpreter.py chore: format 2025-05-10 19:00:01 +04:00
embeddings.py refac: embeddings endpoint 2025-06-05 00:37:31 +04:00
files.py refac 2025-12-03 19:31:23 -05:00
filter.py fix: setting file_handler in a filter would generate errors in messages with no files, because a "files: Null" in metadata would trigger an attempt to delete a non existent files object 2025-09-13 12:57:54 -03:00
groups.py chore: format 2025-12-02 17:16:12 -05:00
headers.py refac: images 2025-11-04 13:30:59 -05:00
logger.py chore: format 2025-08-06 14:27:58 +04:00
middleware.py refac 2025-12-01 13:52:09 -05:00
misc.py refac 2025-12-02 04:18:19 -05:00
models.py refac: show connection type for custom models 2025-12-02 06:19:48 -05:00
oauth.py fix: Add proactive OAuth token refresh for MCP sessions 2025-12-08 18:29:07 +11:00
payload.py refac 2025-10-25 23:01:13 -07:00
pdf_generator.py chore: remove unnecessary Path conversions 2025-03-04 19:53:52 +02:00
plugin.py refac: tools 2025-09-26 19:01:22 -05:00
rate_limit.py feat: signin rate limit 2025-12-02 03:52:38 -05:00
redis.py feat: signin rate limit 2025-12-02 03:52:38 -05:00
response.py fix: ollama tool call 2025-07-18 06:11:53 +08:00
security_headers.py chore: format 2024-11-30 23:36:30 -08:00
task.py refac/fix: rag template placeholder substitution 2025-11-11 00:08:05 -05:00
tools.py refac 2025-11-25 16:27:27 -05:00
webhook.py refac/fix: trusted env for proxy 2025-11-04 12:21:18 -05:00