Skip to content

Support importing Feishu/Lark credentials from lark-cli #405

Description

@jolestar

Context

AgentInbox wants Feishu/Lark credentials to be owned by UXC, with AgentInbox storing only a uxcAuth / configRef reference.

On a machine with lark-cli installed and logged in, the CLI already has enough local configuration to identify the active Feishu/Lark app and user session:

  • lark-cli profile list shows the active app/profile and brand
  • lark-cli auth status shows token status and user identity
  • ~/.lark-cli/config.json stores appId and an appSecret reference such as { "source": "keychain", "id": "appsecret:<appId>" }
  • the secret itself is stored through lark-cli's secure storage/keychain layer, not as plaintext config

Today UXC has auth credential import --from gh, but no equivalent import path for lark-cli. Operators must either configure a Feishu credential manually in UXC or copy secret material by hand, which is exactly the boundary we want to avoid.

Proposal

Add a UXC credential import source for lark-cli:

uxc auth credential import feishu-tenant --from lark-cli

Optional flags could include:

uxc auth credential import feishu-tenant --from lark-cli --profile <profile>
uxc auth credential import feishu-tenant --from lark-cli --skip-binding
uxc auth credential import feishu-tenant --from lark-cli --binding-id <id>
uxc auth credential import feishu-tenant --from lark-cli --force

The import should create a bearer credential with Feishu/Lark tenant-token bootstrap configured from the imported app credentials, and should add an endpoint binding for the provider OpenAPI endpoint unless --skip-binding is passed.

Desired Credential Shape

For Feishu:

  • credential id: user-supplied
  • auth type: bearer
  • fields:
    • app_id
    • app_secret
  • bootstrap:
    • token endpoint: https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
    • request JSON: { "app_id": "{{field:app_id}}", "app_secret": "{{field:app_secret}}" }
    • access token pointer: /tenant_access_token
    • expires-in pointer: /expire
    • success code pointer: /code
    • success code value: 0
  • binding:
    • host: open.feishu.cn
    • path prefix: /open-apis
    • scheme: https

For Lark global, the host/token endpoint should match the active lark-cli app brand/endpoint conventions.

Safety Requirements

  • Do not print app secret or access tokens in command output.
  • Preserve UXC's normal masked auth credential info output behavior.
  • If lark-cli stores the app secret in keychain/encrypted storage, import should read through the same supported local mechanism instead of requiring manual plaintext copying.
  • If the secret cannot be read because keychain access is blocked, fail with a clear remediation message.
  • Do not switch or remove the active lark-cli profile.

Acceptance Criteria

  • uxc auth credential import <id> --from lark-cli imports the active lark-cli app credential into UXC.
  • uxc auth bootstrap refresh <id> succeeds after import.
  • uxc auth binding match https://open.feishu.cn/open-apis/im/v1/messages matches the imported credential when binding creation is enabled.
  • Import output masks all secret/token material.
  • --profile <profile> imports a non-active lark-cli profile without changing lark-cli's active profile.
  • --skip-binding creates only the credential/bootstrap config.

Why This Matters

This keeps the product boundary clean:

  • lark-cli remains a convenient local auth/bootstrap tool for users
  • UXC becomes the reusable credential owner for provider API execution
  • AgentInbox can reference Feishu/Lark auth by UXC credential id without storing app secrets

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions