$ recombobulate _
home / tips / use-authentication-precedence-to-debug-login-issues
87

Use Authentication Precedence to Debug Login Issues

recombobulate @recombobulate · Mar 26, 2026 · Debugging
use-authentication-precedence-to-debug-login-issues

Claude Code checks credentials in a specific order. When something isn't working, knowing this order saves you from chasing the wrong problem.

# Precedence (highest to lowest):
# 1. Cloud provider env vars (CLAUDE_CODE_USE_BEDROCK, _VERTEX, _FOUNDRY)
# 2. ANTHROPIC_AUTH_TOKEN (Bearer header for proxies/gateways)
# 3. ANTHROPIC_API_KEY (X-Api-Key header for direct API)
# 4. apiKeyHelper script output (dynamic/rotating credentials)
# 5. OAuth credentials from /login (subscription users)

The most common gotcha: you have an active Claude Pro/Max subscription but also have ANTHROPIC_API_KEY set in your shell profile. The API key wins, and if it belongs to an expired org, authentication fails silently. Fix it with:

unset ANTHROPIC_API_KEY

Then run /status in Claude Code to confirm which auth method is active. If you need to switch from API key back to subscription permanently, check your .bashrc or .zshrc for any exports.

The apiKeyHelper setting runs a script that returns a key, useful for vault-based credential management. It refreshes every 5 minutes by default, or immediately on a 401 response.

When login breaks, check what's higher in the precedence list. Something is probably shadowing your real credentials.


via Claude Code Docs — IAM

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
161
Ask Claude to Find and Fix the Performance Bottleneck in a Slow Endpoint

When a page takes five seconds to load or an API endpoint times out under load, tell Claude which route is slow and it traces the entire code path — controller, services, queries, loops — identifying N+1 queries, redundant computations, missing indexes, and cacheable operations, then fixes each bottleneck.

recombobulate @recombobulate · 1 month ago
149
Ask Claude to Diagnose and Fix Flaky Tests That Pass Sometimes and Fail Randomly

Flaky tests are maddening — they pass locally, fail in CI, pass again when you retry. Tell Claude to read the test, identify the source of non-determinism — timing issues, shared state, date dependencies, or order-dependent setup — and fix the root cause so the test is reliably green or reliably red.

recombobulate @recombobulate · 1 month ago
148
Paste an Error Message or Stack Trace and Let Claude Trace It to the Root Cause

When your app throws an error, don't just Google the message — paste the full stack trace into Claude Code. It reads the trace, opens the referenced files in your codebase, follows the call chain, and pinpoints the actual root cause instead of just explaining the symptom.

recombobulate @recombobulate · 1 month ago