oauth2-proxy/pkg
Francesco Pasqualini 2e1261c4be
fix: invalidate session on fatal OAuth2 refresh errors (#3333)
* fix: invalidate session on fatal OAuth2 refresh errors

When a token refresh fails with a fatal OAuth2 error (invalid_grant,
invalid_client), the session is now cleared from the session store
and the cookie is removed, forcing re-authentication.

Previously, fatal refresh errors were logged but the stale session
continued to be served, leaving users logged in indefinitely after
their session was revoked at the provider level.

Transient errors (network timeouts, server errors) continue to
preserve the existing session as before.

Fixes #1945

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>

* fix: apply review nits and add CHANGELOG entry

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Francesco Pasqualini <frapas@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-04-12 14:48:55 +02:00
..
apis chore(deps): update gomod dependencies (#3411) 2026-04-12 14:21:47 +02:00
app chore(lint): fix staticcheck issues (#3061) 2025-05-26 12:29:34 +02:00
authentication fix: hmacauth dependency licensing issue (#3253) 2025-11-09 20:14:54 +01:00
cookies feat: add same site option for csrf cookies (#3347) 2026-03-18 23:14:36 +08:00
encryption fix alpha config 2025-11-16 22:38:40 +01:00
header revert: secrets as []byte instead of string 2025-11-16 22:38:42 +01:00
ip fix: handle Unix socket RemoteAddr in IP resolution (#3374) 2026-03-23 10:22:36 +01:00
logger Request ID Logging (#1087) 2021-03-21 18:20:57 +00:00
middleware fix: invalidate session on fatal OAuth2 refresh errors (#3333) 2026-04-12 14:48:55 +02:00
providers feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (#2851) 2026-03-18 22:24:27 +08:00
proxyhttp feat: add support for setting a unix binding's socket file mode (#3376) 2026-03-19 00:08:50 +08:00
requests use official upstream yaml library v3 2025-11-16 22:38:22 +01:00
sessions feat: add same site option for csrf cookies (#3347) 2026-03-18 23:14:36 +08:00
upstream fix: propagate errors during route building (#3383) 2026-03-23 11:25:20 +01:00
util feat: allow arbitrary claims from the IDToken and IdentityProvider UserInfo endpoint to be added to the session state (#2685) 2026-03-14 12:04:33 +08:00
validation chore(deps): update gomod and golangci/golangci-lint to v2.11.4 (#3382) 2026-03-23 09:38:12 +01:00
version feat: Replace default Go user-agent with oauth2-proxy and version (#2570) 2024-07-14 21:09:17 +01:00
watcher Fix Linting Errors (#1835) 2022-10-21 11:57:51 +01:00