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.
17 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
the problem persist
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.
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.
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.
This bug ahem gets worse. Claude code is now choosing to ignore claude
config set autoUpdates false --globaland 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:
Curiouser and curiouser...all that escalation in 5 days.
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.
Experiencing this when running out of opus tokens and falling back to sonnet. Downgrading as @swoopsus mentions worked.
Same OAuth authentication issue in devcontainers with subscriber account.
Thank you for this. BTW I'm on Ubuntu using the native install and, without uninstalling anything, just ran this:
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.
i just installed and im getting the error, how i downgrade on windows?
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
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.
# 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
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.