[Bug] Z.ai OAuth succeeds but ZCode fails with zai_oauth_required on Ubuntu
Nobody has claimed this yet.
- 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
- Install and open the ZCode desktop application on Ubuntu Linux.
- Click “Connect to Z.ai.”
- Select/use the Global Z.ai authentication option.
- Sign in through the browser using the account that owns the active paid ZCode subscription.
- Complete the authorization process.
- Observe that the browser displays “Authorization successful” and redirects back to the application.
- Observe that ZCode displays “登录失败,请重试” (“Login failed, please retry”).
- Check the terminal output.
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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