1
This commit is contained in:
@@ -379,11 +379,24 @@ func (c *CodexAPIAuth) ObtainAuthorizationCode() (string, error) {
|
||||
|
||||
// 解析 continue_url
|
||||
wsResp, _ := client.ReadBody(resp)
|
||||
c.logStep(StepSelectWorkspace, "工作区响应: %s", string(wsResp))
|
||||
|
||||
var wsResult struct {
|
||||
ContinueURL string `json:"continue_url"`
|
||||
Page struct {
|
||||
Type string `json:"type"`
|
||||
} `json:"page"`
|
||||
Error string `json:"error"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
if err := json.Unmarshal(wsResp, &wsResult); err != nil || wsResult.ContinueURL == "" {
|
||||
c.logError(StepSelectWorkspace, "未获取到 continue_url")
|
||||
if err := json.Unmarshal(wsResp, &wsResult); err != nil {
|
||||
c.logError(StepSelectWorkspace, "解析响应失败: %v, 原始: %s", err, string(wsResp))
|
||||
return "", fmt.Errorf("解析响应失败: %v", err)
|
||||
}
|
||||
|
||||
if wsResult.ContinueURL == "" {
|
||||
c.logError(StepSelectWorkspace, "未获取到 continue_url, page=%s, error=%s, msg=%s",
|
||||
wsResult.Page.Type, wsResult.Error, wsResult.Message)
|
||||
return "", fmt.Errorf("未获取到 continue_url")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user