[BUG] OAuth error: Request failed with status code 403
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 CLI 登录时返回 403 错误。
What Should Happen?
你运行 claude login
Claude Code 向 auth.anthropic.com 发起 OAuth 请求,生成一个验证 URL 和验证码
你在浏览器打开 URL,输入验证码,完成授权
Error Messages/Logs
Steps to Reproduce
复现步骤:
准备一台中国大陆的 Linux 服务器,使用 mihomo(Clash Meta)代理,节点为红杏云的 Trojan/Hysteria2 节点
配置代理环境变量:
bash export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890
确认代理对其他 Anthropic 域名正常:
bash curl -I --proxy http://127.0.0.1:7890 https://api.anthropic.com # 返回 200
运行 Claude Code 登录:
bash claude login
复制 URL 到浏览器,输入验证码,提交
结果: 终端返回 403 {"error":{"type":"forbidden","message":"Request not allowed"}}
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.80 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Terminal.app (macOS)
Additional Information
现在的问题是当我成功登录Claude.ai max账户后,浏览器是可以正常使用claude ai的,但是通过claude代码的cli方式登录时,粘贴授权码后,一直报错:OAuth error: Request failed with status code 403。另外,IP已经确定是没问题的,也没有指定环境变量
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗