Commit graph

6 commits

Author SHA1 Message Date
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
Timothy Jaeryang Baek
99a7823e01 refac: db 2025-11-28 01:17:43 -05:00
Taylor Wilsdon
c107a3799f Added a targeted utility to wipe all OAuth sessions for a provider so the cleanup can remove stale access tokens across every user when a connection is updated 2025-10-18 14:00:46 -04:00
Timothy Jaeryang Baek
77e971dd9f feat: oauth2.1 mcp integration 2025-09-25 01:49:16 -05:00
Timothy Jaeryang Baek
7693d0e2b0 refac 2025-09-08 18:09:01 +04:00
Timothy Jaeryang Baek
217f4daef0 feat: server-side OAuth token management system
Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
2025-09-08 18:05:43 +04:00