claude-code - 💡(How to fix) Fix [BUG] 401 Authentication Error — OAuth token rejected on all servers despite valid Max 20x subscription [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48079Fetched 2026-04-15 06:33:50
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3subscribed ×1

Error Message

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

Code Example

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

---

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

---



---

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

[BUG] 401 Authentication Error — OAuth token rejected on all servers despite valid Max 20x subscription

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

After working normally (including this morning), Claude Code suddenly started returning 401 authentication errors on every command, including /login, /logout, and claude login. This happens across all my servers (multiple VPS instances), ruling out a local configuration issue.

The welcome screen correctly identifies my account (name, email, organization, Max subscription), but every subsequent command fails with:

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

Environment

  • Claude Code version: v2.1.107
  • OS: Ubuntu 24 (multiple servers: Vultr Santiago, Contabo France/USA)
  • Node.js: Latest LTS
  • Subscription: Claude Max 20x (active, with plenty of usage available)
  • Shell: Bash
  • Connection: SSH (tested with MobaXterm, PuTTY, PowerShell SSH, VNC)

Steps to Reproduce

  1. Open SSH session to any server
  2. Run claude
  3. Welcome screen shows correctly: "Welcome back [name]!", Max subscription, correct email and organization
  4. Type any command → 401 error
  5. Try /login → 401 error
  6. Try claude logout → 401 error
  7. Try claude login → 401 error
  8. Delete ~/.claude/.credentials.json and retry → same result
  9. Repeat on a completely different server → same result

Additional Context

  • This is NOT a paste/terminal issue. The 401 error occurs before even reaching the token paste step — the OAuth token stored server-side appears to be rejected.
  • The problem started suddenly today (April 14, 2026) after working fine this morning.
  • I successfully completed the OAuth browser flow multiple times, but even after generating fresh tokens, the 401 persists.
  • There were related Anthropic outages on April 13 (Claude.ai down, login affected 15:31–16:19 UTC) and April 14 (degraded admin API endpoints 09:24–15:21 UTC). The timing suggests the outage may have corrupted or invalidated existing OAuth tokens.
  • No ANTHROPIC_API_KEY environment variable is set — purely OAuth authentication via Max subscription.
  • ~/.claude/ directory contains no auth* or .credentials* files, suggesting Linux OAuth storage may not be persisting correctly.

Troubleshooting Already Attempted

  • claude logout + claude login — returns 401
  • rm -f ~/.claude/.credentials.json — no effect
  • rm -rf ~/.claude/auth* — no files found
  • npm update -g @anthropic-ai/claude-code — updated to latest v2.1.107, same issue
  • unset ANTHROPIC_API_KEY — confirmed no API key conflict
  • Tested on 5+ different servers — same behavior on all
  • Tested with multiple SSH clients (MobaXterm, PuTTY, PowerShell, VNC) — same result
  • Cleared libsecret keyring — no effect
  • Used expect to automate token paste — token sent but still rejected

What Should Happen

After completing the OAuth flow, Claude Code should accept the new token and authenticate API requests normally. The /login command should never itself return a 401 — it should always allow re-authentication.

Related Issues

  • #44092 — Identical symptoms (welcome screen correct, all commands 401)
  • #44930 — OAuth token expired, no recovery path
  • #33811 — OAuth token expired, login/logout/all commands fail with 401
  • #33879 — Same 401 loop, marked as duplicate

What Should Happen?

[BUG] 401 Authentication Error — OAuth token rejected on all servers despite valid Max 20x subscription

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

After working normally (including this morning), Claude Code suddenly started returning 401 authentication errors on every command, including /login, /logout, and claude login. This happens across all my servers (multiple VPS instances), ruling out a local configuration issue.

The welcome screen correctly identifies my account (name, email, organization, Max subscription), but every subsequent command fails with:

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

Environment

  • Claude Code version: v2.1.107
  • OS: Ubuntu 24 (multiple servers: Vultr Santiago, Contabo France/USA)
  • Node.js: Latest LTS
  • Subscription: Claude Max 20x (active, with plenty of usage available)
  • Shell: Bash
  • Connection: SSH (tested with MobaXterm, PuTTY, PowerShell SSH, VNC)

Steps to Reproduce

  1. Open SSH session to any server
  2. Run claude
  3. Welcome screen shows correctly: "Welcome back [name]!", Max subscription, correct email and organization
  4. Type any command → 401 error
  5. Try /login → 401 error
  6. Try claude logout → 401 error
  7. Try claude login → 401 error
  8. Delete ~/.claude/.credentials.json and retry → same result
  9. Repeat on a completely different server → same result

Additional Context

  • This is NOT a paste/terminal issue. The 401 error occurs before even reaching the token paste step — the OAuth token stored server-side appears to be rejected.
  • The problem started suddenly today (April 14, 2026) after working fine this morning.
  • I successfully completed the OAuth browser flow multiple times, but even after generating fresh tokens, the 401 persists.
  • There were related Anthropic outages on April 13 (Claude.ai down, login affected 15:31–16:19 UTC) and April 14 (degraded admin API endpoints 09:24–15:21 UTC). The timing suggests the outage may have corrupted or invalidated existing OAuth tokens.
  • No ANTHROPIC_API_KEY environment variable is set — purely OAuth authentication via Max subscription.
  • ~/.claude/ directory contains no auth* or .credentials* files, suggesting Linux OAuth storage may not be persisting correctly.

Troubleshooting Already Attempted

  • claude logout + claude login — returns 401
  • rm -f ~/.claude/.credentials.json — no effect
  • rm -rf ~/.claude/auth* — no files found
  • npm update -g @anthropic-ai/claude-code — updated to latest v2.1.107, same issue
  • unset ANTHROPIC_API_KEY — confirmed no API key conflict
  • Tested on 5+ different servers — same behavior on all
  • Tested with multiple SSH clients (MobaXterm, PuTTY, PowerShell, VNC) — same result
  • Cleared libsecret keyring — no effect
  • Used expect to automate token paste — token sent but still rejected

What Should Happen

After completing the OAuth flow, Claude Code should accept the new token and authenticate API requests normally. The /login command should never itself return a 401 — it should always allow re-authentication.

Related Issues

  • #44092 — Identical symptoms (welcome screen correct, all commands 401)
  • #44930 — OAuth token expired, no recovery path
  • #33811 — OAuth token expired, login/logout/all commands fail with 401
  • #33879 — Same 401 loop, marked as duplicate

Error Messages/Logs

Steps to Reproduce

[BUG] 401 Authentication Error — OAuth token rejected on all servers despite valid Max 20x subscription

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

After working normally (including this morning), Claude Code suddenly started returning 401 authentication errors on every command, including /login, /logout, and claude login. This happens across all my servers (multiple VPS instances), ruling out a local configuration issue.

The welcome screen correctly identifies my account (name, email, organization, Max subscription), but every subsequent command fails with:

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":"req_..."}

Environment

  • Claude Code version: v2.1.107
  • OS: Ubuntu 24 (multiple servers: Vultr Santiago, Contabo France/USA)
  • Node.js: Latest LTS
  • Subscription: Claude Max 20x (active, with plenty of usage available)
  • Shell: Bash
  • Connection: SSH (tested with MobaXterm, PuTTY, PowerShell SSH, VNC)

Steps to Reproduce

  1. Open SSH session to any server
  2. Run claude
  3. Welcome screen shows correctly: "Welcome back [name]!", Max subscription, correct email and organization
  4. Type any command → 401 error
  5. Try /login → 401 error
  6. Try claude logout → 401 error
  7. Try claude login → 401 error
  8. Delete ~/.claude/.credentials.json and retry → same result
  9. Repeat on a completely different server → same result

Additional Context

  • This is NOT a paste/terminal issue. The 401 error occurs before even reaching the token paste step — the OAuth token stored server-side appears to be rejected.
  • The problem started suddenly today (April 14, 2026) after working fine this morning.
  • I successfully completed the OAuth browser flow multiple times, but even after generating fresh tokens, the 401 persists.
  • There were related Anthropic outages on April 13 (Claude.ai down, login affected 15:31–16:19 UTC) and April 14 (degraded admin API endpoints 09:24–15:21 UTC). The timing suggests the outage may have corrupted or invalidated existing OAuth tokens.
  • No ANTHROPIC_API_KEY environment variable is set — purely OAuth authentication via Max subscription.
  • ~/.claude/ directory contains no auth* or .credentials* files, suggesting Linux OAuth storage may not be persisting correctly.

Troubleshooting Already Attempted

  • claude logout + claude login — returns 401
  • rm -f ~/.claude/.credentials.json — no effect
  • rm -rf ~/.claude/auth* — no files found
  • npm update -g @anthropic-ai/claude-code — updated to latest v2.1.107, same issue
  • unset ANTHROPIC_API_KEY — confirmed no API key conflict
  • Tested on 5+ different servers — same behavior on all
  • Tested with multiple SSH clients (MobaXterm, PuTTY, PowerShell, VNC) — same result
  • Cleared libsecret keyring — no effect
  • Used expect to automate token paste — token sent but still rejected

What Should Happen

After completing the OAuth flow, Claude Code should accept the new token and authenticate API requests normally. The /login command should never itself return a 401 — it should always allow re-authentication.

Related Issues

  • #44092 — Identical symptoms (welcome screen correct, all commands 401)
  • #44930 — OAuth token expired, no recovery path
  • #33811 — OAuth token expired, login/logout/all commands fail with 401
  • #33879 — Same 401 loop, marked as duplicate

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

Claude Code v2.1.107

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

PowerShell

Additional Information

No response

extent analysis

TL;DR

The most likely fix is to wait for the Anthropic API to recover from the recent outages or to try re-authenticating using a different method, as the issue seems to be related to the OAuth token being rejected.

Guidance

  • Try re-authenticating using a different method, such as using the ANTHROPIC_API_KEY environment variable instead of OAuth.
  • Check the Anthropic API status page for any ongoing outages or maintenance that may be causing the issue.
  • Verify that the OAuth token is being stored correctly on the server-side by checking the ~/.claude/ directory for any authentication files.
  • If the issue persists, try resetting the Claude Code configuration by deleting the ~/.claude/ directory and re-running the OAuth flow.

Example

No code example is provided as the issue seems to be related to the Anthropic API and OAuth authentication.

Notes

The issue may be related to the recent Anthropic outages, and waiting for the API to recover may resolve the issue. Additionally, the fact that the welcome screen correctly identifies the account information suggests that the issue is specific to the OAuth token authentication.

Recommendation

Apply workaround: Try re-authenticating using a different method, such as using the ANTHROPIC_API_KEY environment variable instead of OAuth, to see if the issue is specific to the OAuth token authentication.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING