AI SUMMARY

该文指出在Linux Mint上使用Codex CLI登录时返回“Token exchange failed: 403 Forbidden”错误,原因是终端未配置代理。解决方法是设置代理环境变量:http_proxy、https_proxy指向本地代理(如127.0.0.1:7890),并通过no_proxy排除本地地址(127.0.0.1,localhost,::1)防止登录卡死。文中分别给出了Windows(CMD/PowerShell)和Linux/macOS的临时及永久配置命令。

最近在linux mint上使用codex cli登陆的时候,返回登陆失败等问题

问题分析

是Codex在终端内没有配置proxy的问题

相关报错

Token exchange failed: token endpoint returned status 403 Forbidden

解决方法

windows powershell

Windows 系统(CMD/PowerShell)

:: CMD命令行
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
:: 关键!排除本地地址,防止登录时被代理拦截导致卡死
set no_proxy=127.0.0.1,localhost,::1

:: PowerShell
$env:http_proxy = "http://127.0.0.1:7890"
$env:https_proxy = "http://127.0.0.1:7890"
$env:no_proxy = "127.0.0.1,localhost,::1"

Linux/macOS 系统(终端)

# 临时生效(当前终端会话)
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export no_proxy=127.0.0.1,localhost,::1

# 永久生效(写入配置文件)
echo "export http_proxy=http://127.0.0.1:7890" >> ~/.bashrc
echo "export https_proxy=http://127.0.0.1:7890" >> ~/.bashrc
echo "export no_proxy=127.0.0.1,localhost,::1" >> ~/.bashrc
source ~/.bashrc  # 立即生效
0

评论

0 条

评论加载中...