LibreChat/api/server/controllers/auth
Danny Avila f1a21764f3
🧺 fix: Discard Stale Session Tokens at OpenID Login (#15668)
With `OPENID_REUSE_TOKENS=true`, `sendOpenIDAuthResponse` compares the
incoming token set against `req.session.openidTokens`. Passport runs with
`session: false`, so the Express session is never regenerated at login and a
token set from an earlier authentication survives there. Its refresh token
differs from the one the IdP just issued, which the advanced-session check
reads as "a concurrent refresh already advanced the session": the fresh IdP
tokens are discarded and the stale set is republished. When that stale
access token has already expired, the completed flight's TTL clamps to 1ms
and the publication assertion fails with "OpenID refresh result is no longer
available for publication", which fails every login for as long as the stale
session lives.

The advanced-session comparison exists for refresh races and has no business
at a fresh authorization-code login. The login controller now asks the
publication service to discard whatever the session holds, and the service
does so after its own session reload so the store cannot resurrect the
stale set. Refresh callers are unchanged.

Fixes #15648
2026-09-06 15:07:08 -04:00
..
LoginController.js 🔐 feat: Add Signed CloudFront File Downloads (#12970) 2026-05-06 19:48:30 -04:00
LogoutController.js 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
LogoutController.spec.js 🔒 fix: Refresh MCP OBO Tokens From the Live OpenID Session (#15334) 2026-08-29 23:55:58 -04:00
oauth.js 🧺 fix: Discard Stale Session Tokens at OpenID Login (#15668) 2026-09-06 15:07:08 -04:00
oauth.spec.js 🧺 fix: Discard Stale Session Tokens at OpenID Login (#15668) 2026-09-06 15:07:08 -04:00
TwoFactorAuthController.js 🔐 feat: Add Signed CloudFront File Downloads (#12970) 2026-05-06 19:48:30 -04:00