zai-org / zai-org/feedback

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

Open
#116 11 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ZaiBusinessTokenResolver.exchangeBusinessToken and OAuthService.handleCallback, using the sanitized log to trace the successful initial token response into the failing business-token exchange. Reproduce on Ubuntu 24.04 with ZCode v3.3.4; done means the OAuth callback completes without zai_oauth_required and the application signs in successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
ubuntu
Domain
authentication, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.