Claude Code: OAuth token has expired or Login expired. Run /login (or refresh the setup-token)
Claude Code rejected the saved login or CLAUDE_CODE_OAUTH_TOKEN. Re-authenticate with /login, or mint a fresh setup-token—don’t keep retrying the same request. Short answer: 5 steps. 1) Match the exact auth failure before you wipe settings; 2) Renew an interactive session with /login; 3) Check whether the login window already ended; 4) Fix CLAUDE_CODE_OAUTH_TOKEN automation separately; 5) If renewals keep failing, fix the clock and credential store.
Last updated: · This page is the decision checklist; the tools list for “Fix Claude Code OAuth token expired / Login expired” is a separate URL.
How do I run /login or refresh the setup-token when Claude Code says the OAuth token has expired?
Match the exact auth failure before you wipe settings
Confirm you see `OAuth token has expired`, `OAuth token revoked`, `Login expired · Please run /login`, `Login reached its time limit`, or the non-interactive `Failed to authenticate: OAuth session expired and could not be refreshed` / `authentication_failed`. Those are credential failures, not model outages or usage limits. Error index: https://code.claude.com/docs/en/errors
Renew an interactive session with /login
At the Claude Code prompt run `/login` and finish the browser sign-in. If login is flaky, run `/logout`, quit Claude Code, start `claude` again, and sign in once more. Troubleshoot install/login: https://code.claude.com/docs/en/troubleshoot-install
Check whether the login window already ended
In a shell, run `claude auth status --text`. On Claude Code v2.1.318+, look for a `Sign-in ends:` line and renew before the earlier date with `/login` or `claude auth login`. Using Claude Code does not extend the stored login. Auth docs: https://code.claude.com/docs/en/authentication
Fix CLAUDE_CODE_OAUTH_TOKEN automation separately
If `/status` shows Auth token `CLAUDE_CODE_OAUTH_TOKEN`, Claude Code keeps sending that env value after a 401 instead of falling back to a stored login. Generate a new one-year token with `claude setup-token`, replace the env var, and restart the process—or unset the variable and use `/login`. Bare mode (`--bare`) ignores `CLAUDE_CODE_OAUTH_TOKEN`; use `ANTHROPIC_API_KEY` or an `apiKeyHelper` there instead.
If renewals keep failing, fix the clock and credential store
Wrong system time breaks token validation. On macOS, if `claude doctor` warns the login Keychain isn’t writable, unlock or resync the Keychain so credentials stop falling back to plaintext and then failing. For held accounts (`claude.ai/restricted`), `/login` alone won’t clear the block—open the hold link. Details: https://code.claude.com/docs/en/troubleshoot-install
Which tools are best to fix Claude Code OAuth token expired / Login expired?
Claude Code error reference
Official recovery for OAuth token expired/revoked and Login expired.
Authentication
Sign-in ends dates, /login renewals, and claude setup-token for CI.
Troubleshoot installation and login
Clean re-auth, clock skew, and macOS Keychain recovery.
CLI reference
claude auth status / setup-token command details.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Fix Claude Code OAuth token expired / Login expired” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.