Ubuntu 20.04 下 VS Code Codex 登录报错:Token exchange failed 403

发布时间:2026/7/30 11:37:58
Ubuntu 20.04 下 VS Code Codex 登录报错:Token exchange failed 403 ubuntu20.04在VS Code的Codex登录时出现:Sign-in could not be completed Token exchange failed: token endpoint returned status 403 Forbidden: Country, region, or territory not supported Error code token_exchange_failed Details Token exchange failed: token endpoint returned status 403 Forbidden: Country, region, or territory not supported Return to Codex to retry, switch accounts, or contact your workspace admin if access is restricted.1.运行一下此命令查看本地代理监听地址ss -tuln结果一般为127.0.0.1:xxxx2.修改 VS Code settings.json强制插件走代理2.1VS Code 打开设置右上角打开打开设置 (JSON)粘贴完整配置如有其他配置原有配置保留逗号分隔{ http.proxy: http://127.0.0.1:xxxx, http.noProxy: [127.0.0.1, localhost, ::1], http.proxySupport: override, http.proxyStrictSSL: false }保存文件完全退出 VS Code进程彻底关闭重新打开。3.终端全局注入代理环境变量解决 Node 请求忽略代理问题命令行输入# 填入你的本地代理 export HTTP_PROXYhttp://127.0.0.1:xxxx export HTTPS_PROXYhttp://127.0.0.1:xxxx export ALL_PROXYsocks5://127.0.0.1:xxxx # 强制Node读取环境代理关键参数 export NODE_USE_ENV_PROXY1 # 从当前终端启动VS Code code再打开codex就可以登陆了