auth login --scope 单独补授权会覆盖已有用户授权,与 lark-shared 文档「scope 会累积」不符

Open
#2,877 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go, shell
Domain
cli, documentation

Research direction

The behaviour is in the auth login --scope path of the CLI, so start from the login command and how it merges the requested scopes with the token already stored. The documented expectation is in skills/lark-shared/references/lark-shared-identity-and-permissions.md around line 65. Reproducing needs a Lark account with a broad grant, so the first useful step is to check whether the stored scope set is replaced rather than merged. Done means either login keeps existing scopes or the doc's 'accumulates' wording is corrected.

Written by the indexing model from the issue text.

Description

domain/auth domain/core domain/doc enhancement

环境

  • lark-cli 1.0.84(macOS)
  • Lark 国际版,企业自建应用,用户身份已用 --domain all 授权过(约 200 个 scope)

复现

  1. lark-cli auth status --json --verify:用户身份正常,im:chat.members:read 等 scope 都在,+chat-members-list --as user 可用。
  2. 某命令报缺 contact:user.employee_id:readonly,按 lark-shared 速查表「指定单个 scope 授权」执行:
    lark-cli auth login --scope "contact:user.employee_id:readonly" --no-wait --json,浏览器同意后 lark-cli auth login --device-code <code> --json。
  3. 返回 "granted": ["contact:user.employee_id:readonly", "auth:user.id:read", "offline_access"],"already_granted": []。
  4. 再看 auth status:scope 只剩这 3 个;+chat-members-list --as user 改报 missing required scope(s): im:chat.members:read。

期望

skills/lark-shared/references/lark-shared-identity-and-permissions.md 第 65 行写的是:

多次 login 的 scope 会累积(增量授权)。

期望第 2 步之后原有 scope 保留、新增 1 个。实际是整套被替换。

规避

同一次 login 里带上原范围:lark-cli auth login --domain all --scope "<缺的 scope>",授权后恢复为全部 scope(实测 201 个)。

建议

  • 若「累积」是预期行为:修 CLI,login 时与已有 token 的 scope 合并;
  • 若「替换」是预期行为:改文档,删掉「会累积」,并把速查表和「权限不足处理」里推荐的单独 --scope 写法改成带上原范围,提醒用 auth status 核对。

1.0.85~1.0.98 的发布说明里没看到相关修复;升级到 1.0.98 后,lark-cli skills read lark-shared/references/lark-shared-identity-and-permissions.md 第 65 行仍是「会累积」。覆盖行为本身只在 1.0.84 上观察到,没在 1.0.98 上重复。

Dominant language
Go
Stars
18.2k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
18

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No 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.

More from larksuite/cli

All issues in larksuite/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.