Skip to content

[Bug] Z.ai OAuth succeeds but ZCode fails with zai_oauth_required on Ubuntu #116

Description

@TheFahim

提交前确认 · Pre-submission checklist

  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.

问题类别 · Category

账号 / 登录 · Account / Login

涉及的 Agent 框架 · Agent framework

不涉及框架 · Not framework-specific

严重程度 · Severity

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

I purchased an active ZCode subscription and attempted to sign in to the ZCode desktop application on Ubuntu using “Connect to Z.ai — Global.”

The browser authentication completes successfully and displays “Authorization successful,” but ZCode does not complete the login. The application displays “登录失败,请重试” (“Login failed, please retry”).

The terminal log shows that the initial authentication/token response succeeds with code 0, but the subsequent business-token exchange fails with:

Error: zai_oauth_required

The failure occurs inside ZaiBusinessTokenResolver.exchangeBusinessToken and OAuthService.handleCallback. Because of this, I cannot sign in to ZCode or use my paid subscription.

复现步骤 · Steps to reproduce

  1. Install and open the ZCode desktop application on Ubuntu Linux.
  2. Click “Connect to Z.ai.”
  3. Select/use the Global Z.ai authentication option.
  4. Sign in through the browser using the account that owns the active paid ZCode subscription.
  5. Complete the authorization process.
  6. Observe that the browser displays “Authorization successful” and redirects back to the application.
  7. Observe that ZCode displays “登录失败,请重试” (“Login failed, please retry”).
  8. Check the terminal output.
  9. Observe that oauth.handleCallback fails with Error: zai_oauth_required.

期望表现 · Expected behavior

After successful browser authorization, ZCode should accept the OAuth callback, connect my Z.ai subscription to the desktop application, and sign me in successfully.

实际表现 · Actual behavior

The browser reports that authorization was successful, and the initial token response returns code 0. However, ZCode fails during the business-token exchange with Error: zai_oauth_required.

The application remains logged out and displays “登录失败,请重试” (“Login failed, please retry”).

ZCode 版本 · ZCode version

v3.3.4 [.deb]

设备 / 系统 / 浏览器 · Device / OS / Browser

Ubuntu 24.04 LTS

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

Browser result:
“Authorization successful — Redirecting to the application...”

ZCode result:
“登录失败,请重试” (“Login failed, please retry”)

Relevant sanitized terminal log:

[zaiOAuth] token final response body:
{
"code": 0,
"msg": "",
"data": {
"token": "[REDACTED]",
"user": {
"user_id": "[REDACTED]",
"email": "[REDACTED]",
"name": "[REDACTED]"
},
"zai": {
"access_token": "[REDACTED]"
}
}
}

[zcode-host] [rpc:call] oauth.handleCallback FAIL

Error: zai_oauth_required
at ZaiBusinessTokenResolver.exchangeBusinessToken
at ZaiProviderAdapter.exchangeToken
at OAuthService.runWithAdapterError
at OAuthService.handleCallback

The initial OAuth/token response succeeds, but the subsequent business-token exchange fails.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions