claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Still not fixed the auth bug? How long?

Open csicky opened this issue 4 months ago • 10 comments

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?

This was reported countless times. Yes this is a duplicate or triplicate or so on. I open a new issue to raise awareness. Why every time I have to click the login? It is getting annoying seriously.

What Should Happen?

Should work next day too like it did.

Error Messages/Logs

API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CUPpHpFKkG3u8tCspjLBh"} · Please run /login

Steps to Reproduce

Work in Code. Stop working, move on with your life. Come back next day. Say something to Claude because you forgot about the damn bug (and maybe hope it's been fixed?). Surprise, after you typed everything instead of seeing the Cogitating and such, you get the error. Is this supposed to be a smart system? Why can't remember I was logged in yesterday? Alzheimer perhaps.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

claude --version API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CUPpwhTrDNdARF6ZLzKXy"} · Please run /login

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Cursor

Additional Information

Delete this issue after you read it, it is just meant as a bump, hey fix it already, it is annoying.

csicky avatar Oct 23 '25 08:10 csicky

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/1757
  2. https://github.com/anthropics/claude-code/issues/8815
  3. https://github.com/anthropics/claude-code/issues/6459

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Oct 23 '25 08:10 github-actions[bot]

Found 3 possible duplicate issues:

1. [[BUG] Claude code requires users to constantly login #1757](https://github.com/anthropics/claude-code/issues/1757)

2. [[BUG] Claude code version npm-global (1.0.128), vs code plugin, constantly disconnected and request for re-login #8815](https://github.com/anthropics/claude-code/issues/8815)

3. [[BUG] - API Error: 401      {"type":"error","error":{"type":"authentication_error","message":"OAuth      token has expired. Please obtain a new token or refresh your existing      token."},"request_id":"req_011CSSdA5fqJCVm1m4XMjNks"} #6459](https://github.com/anthropics/claude-code/issues/6459)

This issue will be automatically closed as a duplicate in 3 days.

* If your issue is a duplicate, please close it and 👍 the existing issue instead

* To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Yes Claude this is a duplicate, a deliberate duplicate because you did not fix the problem yet.

csicky avatar Oct 23 '25 08:10 csicky

I found a way to fix the annoyance! Instead of starting with what work I need done, I politely say hi! This way I get either a reply or a 401. Somebody loses some tokens for the random hi, but oh well...

csicky avatar Oct 23 '25 10:10 csicky

Image

csicky avatar Oct 24 '25 08:10 csicky

for the VS cod extension, the code claude login stopped working at all. It works well in the terminal mode, but in the extension the login just fails. I use /login and authenticate my Claude Max account, but then in the extension just nothing happens.

Cannot effectively work with code claude now, please help! this is started after claude v2 upgrade I think.

Extension output:

2025-10-24 12:31:15.238 [info] Received message from webview: {"type":"request","requestId":"z5cuk6h6r08","request":{"type":"login","method":"claudeai"}}
2025-10-24 12:31:15.239 [info] Starting OAuth login flow: method=claudeai
2025-10-24 12:31:21.834 [error] Failed to fetch subscription: AxiosError: Request failed with status code 401
2025-10-24 12:31:22.015 [info] Saving OAuth tokens to secure storage
2025-10-24 12:31:22.015 [info] Login successful
2025-10-24 12:31:22.015 [info] Getting authentication status
2025-10-24 12:31:22.015 [info] Keychain read failed, trying file fallback
2025-10-24 12:31:22.015 [info] OAuth tokens found in secure storage
2025-10-24 12:31:22.015 [info] Auth status: method=claudeai

leonprou avatar Oct 24 '25 09:10 leonprou

Hi everyone 👋 I encountered the same issue — the Claude Code VS Code extension couldn’t log in or connect even though I have a Claude Pro subscription.

After some digging, I found the root cause and the full fix 👇

⚠️ Root Cause

The VS Code extension itself doesn’t handle authentication. It relies entirely on the Claude CLI for login and token management.

If you haven’t installed or logged in via the CLI, the extension will fail with errors like:

❌ “Missing API key” ❌ “Unable to connect to Anthropic services” ❌ “401 Unauthorized”

✅ Solution: Link the VS Code extension to your Claude CLI login 1️⃣ Install Claude CLI npm install -g @anthropic-ai/claude-code

2️⃣ Log in using your Claude Pro subscription claude login --method=claudeai

💡 This will open a browser window for you to log in with your Claude.ai account. After successful login, a file ~/.claude.json will be created to store your session.

3️⃣ Verify your login claude whoami

You should see:

Using Claude.ai Subscription

✅ That means your Pro account is active and recognized.

4️⃣ Open VS Code again

Once the CLI is logged in, the VS Code extension will automatically detect your session — no need to enter any API key or credentials manually.

🧰 Optional: If you use a local proxy

Add these environment variables to .vscode/settings.json:

{ "claude-code.environmentVariables": [ { "name": "HTTP_PROXY", "value": "http://127.0.0.1:your" }, { "name": "HTTPS_PROXY", "value": "http://127.0.0.1:your" } ] }

Adjust the proxy address/port to match your setup.

🧠 Explanation

As of Claude Code v2.0.26, the VS Code extension is just a front-end interface for the CLI. All login, authentication, and API calls go through the CLI backend.

So the correct setup order is:

🪄 Install CLI → Log in (Pro) → Open VS Code

💬 In short

The extension doesn’t log in directly — it mirrors the CLI’s login session. Make sure your CLI is logged in with Claude Pro, and the plugin will start working instantly.

Hugh-Afterlight avatar Oct 25 '25 03:10 Hugh-Afterlight

API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CUda9zmnYUhb5VahYiCPU"} · Please run /login

How long? Is there anybody even working on this bug? Is it in attention to somebody that this is actually ANNOYING????

csicky avatar Oct 30 '25 14:10 csicky

Happened again. Seriously, I will redirect the monthly 200$ to Codex if this keeps happening.

csicky avatar Nov 01 '25 10:11 csicky

Took me a while and several tries to fix this but in the end it worked, here's what I did:

  1. First you need to uninstall (not just disable) the Claude Code extension in VSCode and quit the app.

  2. Reinstall Claude Code (you may want to back up before running these).

# remove all claude installs
brew uninstall claude-code claude
npm uninstall -g --force @anthropic-ai/claude-code
rm /opt/homebrew/bin/claude
rm ~/.local/bin/claude

# remove claude vscode extension
rm -rf ~/.vscode/extensions/*anthropic*

# clear settings
rm -rf ~/.*claude*

# clear passwords
security delete-generic-password -a "Claude Key"
security delete-generic-password -a $USER -s "Claude Code-credentials"

# reinstall claude
curl -fsSL https://claude.ai/install.sh | bash

# reinstall vscode extension via claude
claude /ide
  1. Then reopen VSCode and if you type /cost into the Claude Code extension you should see your current plan.

jererobles avatar Nov 07 '25 22:11 jererobles

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 09 '25 10:12 github-actions[bot]