This commit is contained in:
2026-02-02 11:14:20 +08:00
parent 11bc01e8ed
commit 389b8eca28

View File

@@ -494,8 +494,22 @@ func (c *CodexAPIAuth) ObtainAuthorizationCode() (string, error) {
}
c.logStep(StepInputPassword, "密码验证成功")
// 打印密码验证响应,看看服务器返回了什么
c.logStep(StepInputPassword, "密码验证响应: %s", string(body[:min(500, len(body))]))
// 解析密码验证响应
json.Unmarshal(body, &data)
// 检查下一步是什么
nextPageType := ""
if page, ok := data["page"].(map[string]interface{}); ok {
if pt, ok := page["type"].(string); ok {
nextPageType = pt
}
}
// 如果需要邮箱验证,这是新账号的问题
if nextPageType == "email_otp_verification" {
c.logError(StepInputPassword, "账号需要邮箱验证,无法继续 Codex 授权流程")
return "", fmt.Errorf("账号需要邮箱验证,请使用浏览器模式或等待账号状态更新")
}
} else {
c.logStep(StepInputPassword, "跳过密码验证步骤 (服务器未要求)")
}