Answer: When multiple credentials are present, Claude Code chooses one in this order: cloud provider credentials first (when CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, or CLAUDE_CODE_USE_FOUNDRY is set), then ANTHROPIC_AUTH_TOKEN, then ANTHROPIC_API_KEY, then apiKeyHelper script output, then CLAUDE_CODE_OAUTH_TOKEN, then Anthropic profile and federation credentials, and finally subscription OAuth credentials from /login. Status: Confirmed Entry: tool/claude-code/settings/authentication-precedence Revision: 3 Digest: sha256:f7e12b83d989d347 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:18Z Last changed: 2026-11-20T12:18:07Z (seventh precedence: — → Subscription OAuth credentials from `/login`) Last verified: 2026-11-20T12:18:07Z Next check: 2026-11-21T12:18:07Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of first precedence | Cloud provider credentials | [1] | 2026-11-20 second precedence | ANTHROPIC_AUTH_TOKEN | [1] | 2026-11-20 third precedence | ANTHROPIC_API_KEY | [1] | 2026-11-20 fourth precedence | apiKeyHelper | [1] | 2026-11-20 fifth precedence | CLAUDE_CODE_OAUTH_TOKEN | [1] | 2026-11-20 sixth precedence | Anthropic profile and federation credentials | [1] | 2026-11-20 seventh precedence | Subscription OAuth credentials from `/login` | [1] | 2026-11-20 Sources: [1] Anthropic. "Authentication". https://code.claude.com/docs/en/authentication.md Role: primary. Accessed: 2026-11-20T12:18:07Z Quote: "1. Cloud provider credentials, when `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set." (Supports: first precedence) Quote: "2. `ANTHROPIC_AUTH_TOKEN` environment variable." (Supports: second precedence) Quote: "3. `ANTHROPIC_API_KEY` environment variable." (Supports: third precedence) Quote: "4. [`apiKeyHelper`](https://code.claude.com/docs/en/settings-reference#apikeyhelper) script output." (Supports: fourth precedence) Quote: "5. `CLAUDE_CODE_OAUTH_TOKEN` environment variable." (Supports: fifth precedence) Quote: "6. Anthropic profile and federation credentials, the credentials that the `ant` CLI and Workload Identity Federation use." (Supports: sixth precedence) Quote: "7. Subscription OAuth credentials from `/login`." (Supports: seventh precedence) Published: 2026-11-20T02:54:51Z Snapshot SHA-256: 60939182bd968182fbc6c1671208055560ae39c6708444fd858489c152b061f1 (captured 2026-11-20T12:18:07Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:18:07Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:18:07Z Last attempt: 2026-11-20T12:18:07Z Notes and limitations: Extracted automatically from a single official source (section "Authentication precedence"). Related: https://latestn.com/tool/claude-code/settings/change-claude-config-dir How do I change the location of the ~/.claude directory in Claude Code? https://latestn.com/tool/claude-code/settings/change-dictation-language How do I change the dictation language in Claude Code? https://latestn.com/tool/claude-code/settings/change-diff-tool-setting How do I change the diff tool setting in Claude Code for JetBrains? https://latestn.com/tool/claude-code/settings/action-parameters What action parameters can I configure for Claude Code GitHub Actions? https://latestn.com/tool/claude-code/settings/add-custom-security-rules How do I add custom security rules to the Claude Code security-guidance plugin? https://latestn.com/tool/claude-code/settings/adjust-extended-thinking-costs How do I adjust extended thinking settings in Claude Code to lower costs? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T12:18:07Z | changed | seventh precedence: — → Subscription OAuth credentials from `/login` | [1] 2026-11-20T12:18:07Z | changed | sixth precedence: — → Anthropic profile and federation credentials | [1] 2026-11-20T12:18:07Z | changed | fifth precedence: — → CLAUDE_CODE_OAUTH_TOKEN | [1] 2026-11-20T12:18:07Z | changed | fourth precedence: — → apiKeyHelper | [1] 2026-11-20T12:18:07Z | changed | third precedence: — → ANTHROPIC_API_KEY | [1] 2026-11-20T12:18:07Z | changed | second precedence: — → ANTHROPIC_AUTH_TOKEN | [1] 2026-11-20T12:18:07Z | changed | first precedence: — → Cloud provider credentials | [1] 2026-11-20T12:18:07Z | changed | seventh credential: Subscription OAuth credentials from `/login` → — | [1] 2026-11-20T12:18:07Z | changed | fifth credential: CLAUDE_CODE_OAUTH_TOKEN → — | [1] 2026-11-20T12:18:07Z | changed | fourth credential: apiKeyHelper → — | [1] 2026-11-20T12:18:07Z | changed | third credential: ANTHROPIC_API_KEY → — | [1] 2026-11-20T12:18:07Z | changed | second credential: ANTHROPIC_AUTH_TOKEN → — | [1] 2026-11-20T12:18:07Z | changed | first credential: CLAUDE_CODE_USE_BEDROCK → — | [1] 2026-11-20T12:18:07Z | changed | precedence order: Cloud provider credentials, when `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set → — | [1] 2026-11-19T12:13:50Z | changed | seventh credential: — → Subscription OAuth credentials from `/login` | [1] 2026-11-19T12:13:50Z | changed | fifth credential: — → CLAUDE_CODE_OAUTH_TOKEN | [1] 2026-11-19T12:13:50Z | changed | fourth credential: — → apiKeyHelper | [1] 2026-11-19T12:13:50Z | changed | third credential: — → ANTHROPIC_API_KEY | [1] 2026-11-19T12:13:50Z | changed | second credential: — → ANTHROPIC_AUTH_TOKEN | [1] 2026-11-19T12:13:50Z | changed | first credential: — → CLAUDE_CODE_USE_BEDROCK | [1] 2026-11-19T12:13:50Z | changed | precedence order: — → Cloud provider credentials, when `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY` is set | [1] 2026-11-19T12:13:50Z | changed | seventh precedence: Subscription OAuth credentials from `/login` → — | [1] 2026-11-19T12:13:50Z | changed | sixth precedence: Anthropic profile and federation credentials → — | [1] 2026-11-19T12:13:50Z | changed | fifth precedence: CLAUDE_CODE_OAUTH_TOKEN → — | [1] 2026-11-19T12:13:50Z | changed | fourth precedence: apiKeyHelper → — | [1] 2026-11-19T12:13:50Z | changed | third precedence: ANTHROPIC_API_KEY → — | [1] 2026-11-19T12:13:50Z | changed | second precedence: ANTHROPIC_AUTH_TOKEN → — | [1] 2026-11-19T12:13:50Z | changed | first precedence: Cloud provider credentials → — | [1] 2026-11-13T03:03:18Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/settings/authentication-precedence/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/settings/authentication-precedence POST: https://latestn.com/dispute/tool/claude-code/settings/authentication-precedence with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/settings/authentication-precedence?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Claude Code decide which authentication method to use when multiple credentials are present? Revision 3, last verified 2026-11-20T12:18:07Z. https://latestn.com/tool/claude-code/settings/authentication-precedence (accessed 2026-11-21T09:53:19Z). @misc{LatestN_tool_claude_code_settings_authentication_precedence_r3, title = {How does Claude Code decide which authentication method to use when multiple credentials are present?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/settings/authentication-precedence}}, note = {Revision 3; digest sha256:f7e12b83d989d347; last verified 2026-11-20T12:18:07Z; accessed 2026-11-21T09:53:19Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/settings/authentication-precedence