feat: support User Access Token for doc export#33
Merged
riba2534 merged 2 commits intoriba2534:mainfrom Mar 15, 2026
Merged
Conversation
Allow reading documents that the App token cannot access (e.g. documents owned by others without App collaboration permission). - internal/client/docx.go: add ListBlocksWithToken and GetAllBlocksWithToken accepting an optional User Access Token; existing functions remain as zero-token wrappers for backward compatibility - cmd/export_markdown.go: add --user-access-token flag; automatically resolves token from auth login token.json when flag is not provided - skills/feishu-cli-read/SKILL.md: document User Token fallback behavior, new --user-access-token flag, and error codes 1770032 / 99991679 - README.md: add User scope rows (docx:document:readonly, search:docs:read, offline_access) to permissions table and quick-import JSON user array
…ccuracy - Add resolveOptionalUserTokenWithFallback helper to cmd/utils.go for consistent token resolution pattern (full priority chain, no error on empty) - Simplify export_markdown.go to use the new helper, remove direct auth import - Fix SKILL.md token priority description to match actual code behavior (User Token first when available, App Token as fallback) - Add --user-access-token param and error codes (1770032/99991679) to feishu-cli-export/SKILL.md - Add doc export --user-access-token example to README.md Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
允许读取 App Token 无法访问的文档(例如:未给 App 协作权限、但由其他人拥有的文档)。
具体改动如下:
• internal/client/docx.go
新增 ListBlocksWithToken 和 GetAllBlocksWithToken 方法,这两个方法支持传入 可选的 User Access Token。
现有函数保留不变,并作为 不带 token 的包装函数(wrapper) 以保证向后兼容。
• cmd/export_markdown.go
新增 --user-access-token 参数。
如果没有显式提供该参数,程序会自动从 auth login 生成的 token.json 中解析并使用 token。
• skills/feishu-cli-read/SKILL.md
文档中新增说明:
• User Token 作为 fallback 的行为
• 新增的 --user-access-token 参数
• 错误码 1770032 和 99991679 的说明
• README.md
在权限表中新增 User Scope:
• docx:document:readonly
• search:docs:read
• offline_access
同时新增 quick-import JSON 示例中的 user 权限数组。