Commit a7fe697
fix: add OAuth proxy cookie refresh to prevent token expiration (#1567)
## Summary
Configures OAuth proxy to proactively refresh authentication cookies
before token expiration, preventing "Token expired or invalid" errors
during long-running sessions.
## Problem
Users encounter `Error: Token expired or invalid` after chatting with
Claude for extended periods. Investigation revealed:
1. **Backend middleware** returns this error when Kubernetes
SelfSubjectAccessReview (SSAR) fails with `IsUnauthorized`
2. **No token refresh mechanism**: OpenShift OAuth tokens have limited
lifetime (typically 24h)
3. **No automatic recovery**: When tokens expire mid-session, users get
stuck with continuous errors
## Solution
Added `--cookie-refresh=1h` to OAuth proxy configurations to proactively
refresh authentication cookies every hour.
### How it works
- **Cookie refresh**: Proxy automatically refreshes the authentication
cookie every hour
- **Seamless UX**: Users get transparent token refresh without
re-authentication
- **Safety margin**: 1-hour refresh interval ensures tokens are
refreshed well before the 23h expiration
- **Production-safe**: Aligns with existing `--cookie-expire=23h0m0s`
setting
## Changes
**Files modified:**
- `components/manifests/overlays/production/frontend-oauth-patch.yaml`
-
`components/manifests/components/oauth-proxy/frontend-oauth-deployment-patch.yaml`
Both files now include:
```yaml
- --cookie-refresh=1h
```
## Testing
- ✅ YAML syntax validated
- ✅ Follows OAuth proxy best practices
- ✅ Conventional commit format verified
## Impact
- **Low risk**: Only adds cookie refresh parameter to existing OAuth
proxy configuration
- **No breaking changes**: Existing functionality unchanged
- **Proactive fix**: Prevents token expiration errors before they occur
- **Improved UX**: Users can work continuously without authentication
interruptions
## References
- OAuth2 Proxy cookie refresh documentation:
https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/overview#cookie-settings
- Related to backend SSAR validation in
`components/backend/handlers/middleware.go`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* OAuth proxy sidecar container configuration has been updated to
automatically refresh authentication cookies on a one-hour interval.
Configuration updates have been applied across both production and
development Kubernetes deployment environments to ensure consistent and
standardized authentication session refresh timing across all
operational deployments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: jsell-rh <jsell@redhat.com>1 parent b6cbae6 commit a7fe697
2 files changed
Lines changed: 2 additions & 0 deletions
File tree
- components/manifests
- components/oauth-proxy
- overlays/production
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
0 commit comments