I keep getting 401 errors about Oauth authentication after...

Resolved 💬 17 comments Opened Aug 17, 2025 by ronnieduke Closed Aug 22, 2025

Bug Description
I keep getting 401 errors about Oauth authentication after a fresh login. I am using claude code inside the shell of Replit, which I have done for a while now without issues, so this is a new issue. If I exit and re-init claude code, the issue seems to go away for a while, but will randomly re-appear in the middle of a coding session.

Environment Info

  • Platform: linux
  • Terminal: xterm-256color
  • Version: 1.0.83
  • Feedback ID: e09a55dd-12c9-4a56-a588-06fe97b1a352

Errors

[{"error":"Error: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the \"X-Api-Key\" or \"Authorization\" headers to be explicitly omitted\n    at file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:950:6454","timestamp":"2025-08-17T16:12:41.862Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"}}\n    at D6.generate (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:942:2449)\n    at sP.makeStatusError (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:2101)\n    at sP.makeRequest (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async KSB.sG1.showErrors (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24578)\n    at async sG1 (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:13705)\n    at async KSB (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24429)\n    at async file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:19524\n    at async cN0 (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:5164)\n    at async V01 (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:19494)","timestamp":"2025-08-17T16:26:15.779Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"}}\n    at D6.generate (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:942:2449)\n    at sP.makeStatusError (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:2101)\n    at sP.makeRequest (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-17T16:26:15.875Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:9932\n    at Q (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:677:13339)\n    at USB (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:29738)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-17T16:26:15.877Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"}}\n    at D6.generate (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:942:2449)\n    at sP.makeStatusError (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:2101)\n    at sP.makeRequest (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-17T16:26:33.212Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"}}\n    at D6.generate (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:942:2449)\n    at sP.makeStatusError (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:2101)\n    at sP.makeRequest (file:///home/runner/workspace/.config/npm/node_global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:5315)\n    at process.processTicksAndRejections (

Note: Error logs were truncated.

View original on GitHub ↗

17 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5893
  2. https://github.com/anthropics/claude-code/issues/5956
  3. https://github.com/anthropics/claude-code/issues/4138

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

merlinoalbus · 11 months ago

the problem persist

jasonwblock · 11 months ago

I'm getting same issue inside of claude code itself when hitting opus limit:
Claude Opus limit reached, now using Sonnet 4
⎿ API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is
currently not supported."}}

But it won't continue in Sonnet.

swoopsus · 11 months ago

SOLUTION! The solution is to downgrade to 1.0.81. Fixed immediately and permanently. I verified by going back to 1.0.82/3, and the problem returned.

Took me half a day to find the solution. Sharing so others dont have to.

Sometimes logging out and in will work, but in my two pro plans eventually that didn't either.

Downgrade works like a charm.

jasonwblock · 11 months ago

I discovered my issue was that I need to reset my token using setup-token. I had done it previously, but changed the install, so it wasn't seeing it.

swoopsus · 11 months ago

This bug ahem gets worse. Claude code is now choosing to ignore claude config set autoUpdates false --global and force you to upgrade. It does this every time I hit the rate limit, and I have to downgrade again to get back to work.

Its a curiously consistent sort of bug, that escalates on a fixed set of rules, each time making harder to keep working after you hit the rate limit:

  1. Hit rate limit: Logout and back in fixes it. Twice.
  2. Third time? That stops working no matter what you do.
  3. After that, you have to downgrade to 1.0.81 to get back to work.
  4. GREAT, that works a few times, BUT,
  5. THEN it starts ignoring your no auto update rule, and updates you to the latest versions (82, 83, and now 84), with the BUG
  6. NOW you have to downgrade every time you hit the limit.

Curiouser and curiouser...all that escalation in 5 days.

lancekyle · 11 months ago

Experiencing the same OAuth authentication issue in Repl.it with my subscriber account. For what it's worth, I can still connect successfully using an API key when needed as a workaround.

nemiliani · 11 months ago

Experiencing this when running out of opus tokens and falling back to sonnet. Downgrading as @swoopsus mentions worked.

dadmaan · 11 months ago

Same OAuth authentication issue in devcontainers with subscriber account.

baogorek · 11 months ago

Thank you for this. BTW I'm on Ubuntu using the native install and, without uninstalling anything, just ran this:

curl -fsSL https://claude.ai/install.sh | bash -s 1.0.81

And it finally worked. Kind of hard to believe this bug got through the smoke tests. It's not a very nice way to greet a customer giving $100 in MRR.

Thalikbussacro · 10 months ago

i just installed and im getting the error, how i downgrade on windows?

 API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not
     supported."},"request_id":"req_011CSL3ipSV48ZpcFk7haYAD"}
GraceFrank · 10 months ago
i just installed and im getting the error, how i downgrade on windows? `` API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."},"request_id":"req_011CSL3ipSV48ZpcFk7haYAD"} ``

SAme i just installed Claude code and i am having this exact same error. Did you choose the option to use your Claude subscription account too?

Thalikbussacro · 10 months ago
SAme i just installed Claude code and i am having this exact same error. Did you choose the option to use your Claude subscription account too?

Yes, but after restarting VSC selecting EXIT on menu it works

Its a little wierd tho, sometimes seems like im typing on a hundred different chats on the console, then i need to start a New session

S-Efekan · 10 months ago
i just installed and im getting the error, how i downgrade on windows? `` API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."},"request_id":"req_011CSL3ipSV48ZpcFk7haYAD"} ``

I had the same issue on my both MacOS and Windows devices, I downloaded with npm at first place so I did:

npm uninstall -g claude

then

npm install -g claude@1.0.81

after this make sure that new version is added to PATH.

YadgarovFayzullo · 10 months ago
npm install -g claude@1.0.81

# npm install -g claude@1.0.81
npm error code ETARGET
npm error notarget No matching version found for claude@1.0.81.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
npm error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache\_logs\2025-08-21T20_57_03_246Z-debug-0.log

S-Efekan · 10 months ago
> npm install -g claude@1.0.81 # npm install -g claude@1.0.81 npm error code ETARGET npm error notarget No matching version found for claude@1.0.81. npm error notarget In most cases you or one of your dependencies are requesting npm error notarget a package version that doesn't exist. npm error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2025-08-21T20_57_03_246Z-debug-0.log

try, npm install -g @anthropic-ai/claude-code@1.0.81

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.