[BUG] Bug Report: 401 Invalid Bearer Token Immediately After Successful Login

Resolved 💬 5 comments Opened Apr 16, 2026 by Luksgeming Closed Jun 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code returns a 401 authentication error immediately after a successful login. The login flow completes and shows "Login successful", but any subsequent message returns a 401 Invalid bearer token error. The UI also always displays "API Usage Billing" even after logging in with a subscription account (Option 1). A colleague using the exact same organization account on a different machine has no issues — their Claude Code works correctly and shows "Claude Max" after login.

What Should Happen?

After completing the OAuth login flow (Option 1 · Claude account with subscription), Claude Code should authenticate correctly, display "Claude Max" as the plan, and respond to messages without any 401 error.

Error Messages/Logs

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"}

Credentials file after login correctly shows:

{
  "claudeAiOauth": {
    "subscriptionType": "max",
    "rateLimitTier": "default_claude_max_20x"
  }
}

Steps to Reproduce

  1. Run claude logout
  2. Delete %USERPROFILE%\.claude\.credentials
  3. Run claude and type /login
  4. Select Option 1 (Claude account with subscription · Pro, Max, Team, or Enterprise)
  5. Complete OAuth flow in Chrome browser — shows "Login successful"
  6. Type any message (e.g., hello or test)
  7. Immediately receives 401 Invalid bearer token error
  8. Repeating /login and sending a message always results in the same 401 error

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

-

Claude Code Version

2.1.110 (native installer)

Platform

Other

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

  • Account type: Organization account (Max plan, rateLimitTier: default_claude_max_20x)
  • No ANTHROPIC_API_KEY environment variable is set
  • Reinstalling via native installer (claude install) did not resolve the issue
  • Deleting credentials and logging in multiple times did not resolve the issue
  • A colleague using the exact same organization account on a different Windows machine works fine and shows "Claude Max" after login
  • Browser used for OAuth: Google Chrome (single profile, organization account active)
  • The issue appears to be that the OAuth token is accepted during login but immediately rejected when making API calls

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗