Skip to content

Windows: token not persisted to keychain after successful OAuth authorization #1552

Description

@easthuihui-git

Bug Description

lark-cli v1.0.56 on Windows 24H2 (Node v24.17.0) cannot persist user tokens to the Windows Credential Manager. Authorization succeeds (API returns 200 with valid token), but subsequent lark-cli auth status reports no_token, and Windows Credential Manager shows no lark-cli entries.

Steps to Reproduce

$env:Path = "C:\Program Files\nodejs;C:\Users\yangdh\AppData\Roaming\npm;" + $env:Path
lark-cli config init --new

(complete browser OAuth, app configured successfully)

2. ```cmd
lark-cli auth login --recommend

(scan QR / open link, authorization succeeds in browser)

lark-cli auth status

(shows user identity missing: `no_token`)

## Expected Behavior

Token should be persisted to Windows Credential Manager and `lark-cli auth status` should show user identity as ready.

## Actual Behavior

Authorization completes successfully (API returns 200), but the token is never written to the Windows Credential Manager. `lark-cli auth status` consistently shows:

```json
{
  "status": "missing",
  "message": "User identity: missing (no token in keychain for ou_xxx)"
}

cmdkey /list returns * NONE *, confirming no credentials were stored. Bot identity (app_id + app_secret) works fine.

Environment

  • OS: Windows 11 24H2
  • lark-cli version: 1.0.56
  • Node.js: v24.17.0
  • Installed via: npm install -g @larksuite/cli
  • Brand: feishu

Additional Context

  • Tried both --recommend and --no-wait --json + --device-code flows — both return tokens but fail to persist
  • Tried running in normal desktop cmd (outside sandbox) — same result
  • Bot identity (app_id/app_secret) works without issues
  • Tried lark-cli update — already at latest (1.0.56)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain/authAuthentication subsystem

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions