LibreChat/api/server/services
J.C. Bartle a74546b60d 🛠️ fix: Recover OpenID refresh token drift
Prefer the browser refresh-token cookie when it differs from the
server-side OpenID session state, and force a real IdP refresh in that
case instead of reusing stale session tokens.

Store a short-lived refresh-token bridge when inline OBO refresh writes
a rotated browser cookie but session persistence fails, so follow-up
refreshes can still recover from the old token.

Keep the bridge grace TTL centralized in RefreshTokenBridge so both
recovery paths use the same env-backed value.

Note: drift is measured against the last-synced browserRefreshToken
marker, so the SSE path (intentionally stale cookie, authoritative
session) does not false-positive. Sessions predating the marker have no
browserRefreshToken; for those, drift falls back to comparing the cookie
against the session refresh token and prefers the cookie on difference.
This is the same self-healing pre-change-session window as the identity
binding fix and re-syncs within one session lifetime.

Tests cover cookie/session drift selection, reusable-session bypass on
drift, bridge storage after session-save failure, and the shared bridge
constant wiring.
2026-06-28 18:25:40 -04:00
..
__tests__ 🛂 fix: Re-Check execute_code Authorization on Event-Driven Tool Loads (#13912) 2026-06-23 08:30:39 -04:00
Artifacts 🪡 fix: Artifact Edit Saves (#13358) 2026-05-27 22:03:42 -07:00
Config 📨 feat: Custom Headers on Built-in Provider Endpoints (#13742) 2026-06-14 17:02:04 -04:00
Endpoints 💸 feat: Per-Agent Endpoint Token Config in Multi-Endpoint Billing (#13738) 2026-06-14 12:00:32 -04:00
Files 🧾 fix: Harden Historical File Authorization (#13918) 2026-06-23 15:49:57 -04:00
Runs
Skills 🧬 feat: Add GitHub Skill Sync (#13293) 2026-06-10 21:05:54 -04:00
start 🧬 chore: Align LibreChat With Agents LangChain Upgrade (#12922) 2026-05-03 12:46:01 -04:00
Threads 🪪 fix: Scope Message Conversation Access (#13183) 2026-05-18 17:34:30 -04:00
Tools 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
ActionService.js fix: Extend and Decouple MCP OAuth Flow Timeouts (#13622) 2026-06-09 17:50:02 -04:00
ActionService.spec.js ⚗️ feat: Agent Context Compaction/Summarization (#12287) 2026-03-21 14:28:56 -04:00
AssistantService.js
AuthService.js 🛠️ fix: Bind OpenID session tokens to authenticated identity 2026-06-28 17:53:46 -04:00
AuthService.spec.js 🛠️ fix: Bind OpenID session tokens to authenticated identity 2026-06-28 17:53:46 -04:00
cleanup.js 📦 refactor: Consolidate DB models, encapsulating Mongoose usage in data-schemas (#11830) 2026-03-21 14:28:53 -04:00
createRunBody.js
GraphApiService.js 🪪 feat: Optimized Entra ID Group Sync with Auto-Creation (#12606) 2026-04-13 08:50:52 -04:00
GraphApiService.spec.js
GraphTokenService.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
initializeMCPs.js 🔐 fix: Honor Admin-Panel MCP Allowlist Overrides Without Restart (#13814) 2026-06-17 20:14:53 -04:00
initializeMCPs.spec.js 🔐 fix: Honor Admin-Panel MCP Allowlist Overrides Without Restart (#13814) 2026-06-17 20:14:53 -04:00
initializeOAuthReconnectManager.js
MCP.js 🛠️ fix: fail closed on OBO MCP user identity mismatch 2026-06-28 15:42:06 -04:00
MCP.spec.js 🛠️ fix: fail closed on OBO MCP user identity mismatch 2026-06-28 15:42:06 -04:00
MCPRequestContext.js 🪢 fix: Tie MCP Cleanup To Resumable Runs (#13769) 2026-06-15 15:26:03 -04:00
OboPolicyService.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
OboTokenService.js 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
OboTokenService.spec.js 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
OpenIDRefreshFlight.js 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
OpenIDRefreshFlight.spec.js 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
OpenIDSessionRefresh.js 🛠️ fix: Recover OpenID refresh token drift 2026-06-28 18:25:40 -04:00
OpenIDSessionRefresh.spec.js 🛠️ fix: Recover OpenID refresh token drift 2026-06-28 18:25:40 -04:00
PermissionService.js 🪪 fix: Filter ACL Principal Details (#13524) 2026-06-05 19:06:41 -04:00
PermissionService.spec.js 🪪 fix: Filter ACL Principal Details (#13524) 2026-06-05 19:06:41 -04:00
PluginService.js
RefreshTokenBridge.js 🛠️ fix: Recover OpenID refresh token drift 2026-06-28 18:25:40 -04:00
RefreshTokenBridge.spec.js 🛠️ fix: keep OIDC refresh bridge during recovery grace 2026-06-28 12:15:43 -04:00
systemGrant.spec.js 📜 feat: Implement System Grants for Capability-Based Authorization (#11896) 2026-03-21 14:28:54 -04:00
ToolService.js 🛠️ fix: centralize OBO identity scoping 2026-06-28 10:39:04 -04:00
twoFactorService.js