Submit a toolSubmit

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.

The problem: 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.

How do I run /login or refresh the setup-token when Claude Code says the OAuth token has expired?

  1. 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

  2. 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

  3. 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

  4. 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.

  5. 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.

All tools for “Fix Claude Code OAuth token expired / Login expired” →

Related fixes

See also AI tools launched today on the daily board.