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

[BUG] OAuth error: Request failed with status code 403

Open Eldorado-ling opened this issue 3 months ago • 12 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?

win11 专业版 git version 2.48.1.windows.1 node v22.19.0 1.0.120 (Claude Code) claude pro 使用账户授权,只要一点击授权就会报错OAuth error: Request failed with status code 403

What Should Happen?

希望能够成功登录

Error Messages/Logs

OAuth error: Request failed with status code 403

Steps to Reproduce

claude /login 1

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

1.0.120 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Image

Eldorado-ling avatar Sep 22 '25 07:09 Eldorado-ling

同样的问题,兄弟你解决了么

crawfordxx avatar Sep 26 '25 07:09 crawfordxx

同样的问题

Lillian-Yo avatar Oct 07 '25 02:10 Lillian-Yo

同样的问题

XYdreamorigin avatar Oct 07 '25 07:10 XYdreamorigin

问题解决了,目前可以正常运行,以下是解决方案: 1.不要太过于相信vpn全局,git bash或者cmd、终端里面用curl ifconfig.me出去看看自己公网ip 2.https://tool.hiofd.com/ip/这里查询ip地址,claude限制国家挺多的,我这边可以发现自己挂全局vpn仍然是中国的ip 3.如果发现自己是限制国家ip,那么用proxy设置http代理端口,再次curl ifconfig.me出去发现ip不是限制国家ip即可。 p.s.如果问题解决了麻烦兄弟们来我csdn点一下关注,我后续还会在csdn上面发详细教程

Issue Resolution Summary: Do not rely solely on VPN global mode. Use curl ifconfig.me in Git Bash, CMD, or terminal to verify your actual public IP address. Check your IP location via https://tool.hiofd.com/ip/. Claude enforces strict geolocation restrictions. In some cases, even with a global VPN enabled, the outbound IP may still appear to be from a restricted country (e.g., China). If your IP is from a restricted region, configure your system or application to use an HTTP proxy. After setting the proxy, re-run curl ifconfig.me to confirm that your IP now originates from an allowed country. P.S. If the issue has been resolved, kindly consider following my CSDN blog; I will continue to post detailed tutorials there.

Image Image

Eldorado-ling avatar Oct 09 '25 05:10 Eldorado-ling

依据以上贡献者的启发,我详细阐述我的解决方法,以解决在cursor中使用Claude code vscode插件出现的网络问题(以mac系统为例): 编辑 Shell 配置文件(推荐)

确定您使用的 Shell

bash echo $SHELL

编辑对应的配置文件

如果是 zsh(macOS 默认):

bash nano ~/.zshrc

如果是 bash:

bash nano ~/.bashrc

在文件末尾添加以下内容

bash export https_proxy=http://127.0.0.1:7890 export http_proxy=http://127.0.0.1:7890 export all_proxy=socks5://127.0.0.1:7890

可选:设置不走代理的地址

export no_proxy=localhost,127.0.0.1

保存并使配置生效

bash source ~/.zshrc # 或 source ~/.bashrc

Zhusongtong avatar Oct 12 '25 05:10 Zhusongtong

现在的问题是当我成功登录Claude.ai Pro 账户后,浏览器是可以正常使用claude ai的,但通过claude code的cli方式login时,粘贴授权码后,一直报错:OAuth error: Request failed with status code 403。另外,IP已经确定是没问题的,也没有指定环境变量

yun2018 avatar Nov 08 '25 03:11 yun2018

现在的问题是当我成功登录Claude.ai Pro 账户后,浏览器是可以正常使用claude ai的,但通过claude code的cli方式login时,粘贴授权码后,一直报错:OAuth error: Request failed with status code 403。另外,IP已经确定是没问题的,也没有指定环境变量

解决没有

longzhang83 avatar Nov 08 '25 22:11 longzhang83

https://api-iam.intercom.io/messenger/web/ping Always return 403

deyinliwork avatar Nov 09 '25 08:11 deyinliwork

现在的问题是当我成功登录Claude.ai Pro 账户后,浏览器是可以正常使用claude ai的,但通过claude code的cli方式login时,粘贴授权码后,一直报错:OAuth error: Request failed with status code 403。另外,IP已经确定是没问题的,也没有指定环境变量

解决没有

解决了吗?我也是,不过有过一次成功登录,是在windows下,登录完后,电脑重启,以及在安装目录下进行了一次/init,windows下安装的claude code 顺利执行完/init 了,之后也可正常对话

0Hzc avatar Nov 09 '25 16:11 0Hzc

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 10 '25 10:12 github-actions[bot]

hey guys, thank you for the solution! On Astrill i could some times make claude code work, some times not. so when it worked, i asked it to make a VPN from scratch, that when activated, run script to apply proxt to terminal, and ever since it has been running smooth - it also helps when i try to use gemini etc. I wrote a bit about it here https://blaris.com/blarisvpn - if there is any interest, i could publish it on github, no problem.

dvdcodez avatar Dec 25 '25 11:12 dvdcodez