What
Claude Code can be signed in by a token handed to it by the program that started it, or through the CLAUDE_CODE_OAUTH_TOKEN environment variable (a named value set outside Claude Code). Several places that handle these tokens changed:
- On a 401 (the server refusing the login), a session whose login came from a host-supplied token, including one passed through a file descriptor, no longer switches to the login saved on the machine, because it may be a different account. The new message reads: "OAuth 401: the login this session is using was refused. The login saved on this machine was not used because it may be a different account. Sign in again in the app that started this session, or run /login."
- The login source is now reported as "env" only when the stored access token matches
CLAUDE_CODE_OAUTH_TOKENor the other environment token source. Before, any setCLAUDE_CODE_OAUTH_TOKENcounted. When the variable is set, the file-descriptor token lookup is skipped. CLAUDE_CODE_OAUTH_TOKENis removed from the environment given to shell commands whendropShellOAuthTokenis set or when a new check passes. Before,dropShellOAuthTokenwas the only condition.- When
CLAUDE_CODE_OAUTH_TOKENis set, loading policy limits now runs the same reset it ran only for credentials not held in the saved store.
Why
A session started by another app can no longer quietly change to a different account when its login is refused; you are asked to sign in again instead. If you sign in with CLAUDE_CODE_OAUTH_TOKEN, which credential Claude Code uses and whether the token reaches commands it runs may differ from before.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
5. `CLAUDE_CODE_OAUTH_TOKEN` environment variable. A long-lived OAuth token generated by [`claude setup-token`](#generate-a-long-lived-token). Use this for CI pipelines and scripts where browser login isn't available. If you run `/login` w…authentication see the edit
A small documentation edit on Authentication touched a line naming CLAUDE_CODE_OAUTH_TOKEN after this was published.