Allow configurable session/auth token TTL to prevent daily re-login
Resolved 💬 4 comments Opened Mar 17, 2026 by avi-seanair Closed May 16, 2026
Problem
When using Claude Code CLI on a machine that isn't used every day (e.g., a secondary laptop), the OAuth session expires after roughly 24 hours of inactivity. This forces a /login re-authentication via browser on the next use.
For users who alternate between machines (e.g., iMac for daily work, MBP for evenings/weekends), this means re-authenticating every time they return to the less-frequently-used machine.
Current Behavior
- OAuth token stored in macOS Keychain
- Token refresh cycle runs while Claude Code is active (~5 min interval)
- Once the session is closed, the refresh token expires server-side after ~24 hours
- No client-side setting to extend this duration
Desired Behavior
A configurable session persistence option, such as:
"sessionTTL": "7d"insettings.jsonor~/.claude.json- A "remember me" flag during
/login(e.g.,/login --persist 7d) - Or simply a longer default refresh token lifetime (7-30 days, consistent with tools like
gh auth,aws sso, Tailscale)
Workarounds Considered (and rejected)
- Heartbeat script / LaunchAgent: Works but shouldn't be necessary for auth persistence
- API key instead of OAuth: Loses the convenience of the OAuth flow
- Leaving a tmux session open: Fragile, not a real solution
Environment
- macOS (Sequoia 15.4)
- Claude Code CLI (latest)
- Multi-machine workflow over Tailscale
Notes
This is a quality-of-life issue for power users who rely on Claude Code across multiple machines but don't use every machine every day. A 7-day refresh token would eliminate the friction entirely.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗