Skip to content

Commit a7fe697

Browse files
maknopclaudemergify[bot]jsell-rh
authored
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/frontend-oauth-deployment-patch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ spec:
3030
- --client-secret-file=/etc/oauth/config/client-secret
3131
- --cookie-secret-file=/etc/oauth/config/cookie_secret
3232
- --cookie-expire=23h0m0s
33+
- --cookie-refresh=1h
3334
- --pass-access-token
3435
- --scope=user:full
3536
- --openshift-delegate-urls={"/":{"resource":"projects","verb":"list"}}

components/manifests/overlays/production/frontend-oauth-patch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spec:
1919
- --client-secret-file=/etc/oauth/config/client-secret
2020
- --cookie-secret-file=/etc/oauth/config/cookie_secret
2121
- --cookie-expire=23h0m0s
22+
- --cookie-refresh=1h
2223
- --pass-access-token
2324
- --scope=user:full
2425
- --openshift-delegate-urls={"/":{"resource":"projects","verb":"list"}}

0 commit comments

Comments
 (0)