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

Resolved 💬 19 comments Opened Sep 22, 2025 by Eldorado-ling Closed Mar 10, 2026

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

<img width="1113" height="626" alt="Image" src="https://github.com/user-attachments/assets/221380b4-0053-485a-aff1-2e52d8a0892f" />

View original on GitHub ↗

19 Comments

crawfordxx · 9 months ago

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

Lillian-Yo · 9 months ago

同样的问题

XYdreamorigin · 9 months ago

同样的问题

Eldorado-ling · 9 months ago

问题解决了,目前可以正常运行,以下是解决方案:
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.

<img width="444" height="325" alt="Image" src="https://github.com/user-attachments/assets/dd0618a0-ce95-4d01-9d83-da666dc2b5cd" />

<img width="1528" height="1057" alt="Image" src="https://github.com/user-attachments/assets/36eb2dd0-a05e-4d0e-9eb6-181ce795135e" />

Zhusongtong · 9 months ago

依据以上贡献者的启发,我详细阐述我的解决方法,以解决在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

yun2018 · 8 months ago

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

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

解决没有

deyinliwork · 8 months ago

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

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

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

github-actions[bot] · 7 months ago

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.

dvdcodez · 6 months ago

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.

KK-AI-LL · 6 months ago
依据以上贡献者的启发,我详细阐述我的解决方法,以解决在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

感谢解决了,让终端也能访问到vpn就行了

kingchn · 6 months ago
问题解决了,目前可以正常运行,以下是解决方案: 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. <img alt="Image" width="444" height="325" src="https://private-user-images.githubusercontent.com/150699289/499177176-dd0618a0-ce95-4d01-9d83-da666dc2b5cd.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg1Mjk4MTIsIm5iZiI6MTc2ODUyOTUxMiwicGF0aCI6Ii8xNTA2OTkyODkvNDk5MTc3MTc2LWRkMDYxOGEwLWNlOTUtNGQwMS05ZDgzLWRhNjY2ZGMyYjVjZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDExNlQwMjExNTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMGYyNGVhNzFjMWM5Yjg1ZWZiMjc2MDU1ZDYzNzE0MDdhODQ0ZDIwYWFjMjhjZWIwN2RkYmU5YWZkMDUzMWVmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Pjyr90RHNbl5CfPsuTPBQMMXcgBYLeILV9S0yc7qhi8"> <img alt="Image" width="1528" height="1057" src="https://private-user-images.githubusercontent.com/150699289/499178003-36eb2dd0-a05e-4d0e-9eb6-181ce795135e.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg1Mjk4MTIsIm5iZiI6MTc2ODUyOTUxMiwicGF0aCI6Ii8xNTA2OTkyODkvNDk5MTc4MDAzLTM2ZWIyZGQwLWEwNWUtNGQwZS05ZWI2LTE4MWNlNzk1MTM1ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDExNlQwMjExNTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMzMxNjFkNWRiNmY3MTZlOTUwZGQ5NWI1YmMwOWQ5NDNlNjBmOWFmOGE3ZWY4MTM0NzI0YzM5YWQ4ZGZmZTFmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.z9FDcIrBC_wOYjw0-hQh7yTy7HJrSH9UYszP-qCPcPs">

确实,通过这个能查询到正确的公网IP地址 https://tool.hiofd.com/ip/

jameelovecat · 6 months ago
问题解决了,目前可以正常运行,以下是解决方案: 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. <img alt="Image" width="444" height="325" src="https://private-user-images.githubusercontent.com/150699289/499177176-dd0618a0-ce95-4d01-9d83-da666dc2b5cd.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg1NzI0NjksIm5iZiI6MTc2ODU3MjE2OSwicGF0aCI6Ii8xNTA2OTkyODkvNDk5MTc3MTc2LWRkMDYxOGEwLWNlOTUtNGQwMS05ZDgzLWRhNjY2ZGMyYjVjZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDExNlQxNDAyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYTQxNGVkZmExNzA0NzI3MDExZDY0YmU1MWRiMDFmMjA5MzcxOGZiM2FlNTU3ZGZhN2JmMTA5ZWFkNzM0MjljJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.XvEkCXyu2XgFq77tdsU1ZTzQlB8qMV3eG8JCp4yZAx0"> <img alt="Image" width="1528" height="1057" src="https://private-user-images.githubusercontent.com/150699289/499178003-36eb2dd0-a05e-4d0e-9eb6-181ce795135e.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg1NzI0NjksIm5iZiI6MTc2ODU3MjE2OSwicGF0aCI6Ii8xNTA2OTkyODkvNDk5MTc4MDAzLTM2ZWIyZGQwLWEwNWUtNGQwZS05ZWI2LTE4MWNlNzk1MTM1ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDExNlQxNDAyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MDFiNmNmMGJhNzFmNGM1NTAzODQ1M2FlN2YwOGQwZGFiMGZmOGU5ZTNkMGYwYmM1NjRhZDVmYmQ5Njg4MzViJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.eNgC5lyi_3WcZ73KBnFNnotCVjImk6CGSUCt_ubF77Q">
jameelovecat · 6 months ago

IP正常的,但是登录时候还是提示“API Error: 403 用户没有有效的claudecode订阅 · Please run /login”,已经订阅了pro了,不知道什么情况~我是完全技术小白,有没有大佬可以给看看,感谢

更新:已解决,梯子不太行,换了代理,再使用上面解决方案可以了

aj-web · 5 months ago

Clash for Windows 默认使用的是 HTTP/SOCKS5 代理,它的工作方式是设置系统代理(即修改 Windows 的"Internet 选项"里的代理设置)。但问题是:CMD 里的 curl 默认不走系统代理
方法一:手动设置环境变量(临时)
在 CMD 里执行:
bashset http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
然后再 curl ifconfig.me 就会走代理了。端口号 7890 以你 Clash 实际配置为准。
方法二:开启 Clash 的 TUN 模式(真全局)
在 Clash for Windows 里:

进入 General 页面
打开 TUN Mode(或者叫 Service Mode,可能需要先安装服务)

TUN 模式会创建一个虚拟网卡,在网络层劫持所有流量,这才是真正的全局代理,所有应用包括 CMD、游戏、各种命令行工具都会走代理。
方法三:PowerShell 用户
powershell$env:http_proxy="http://127.0.0.1:7890"
$env:https_proxy="http://127.0.0.1:7890"

jameelovecat · 5 months ago

是的,已经解决了;之前的解决方案是没有问题的,主要是梯子的问题,换了代理,也打开了TUN Mode现在可以使用了。

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 3 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.