larksuite / larksuite/cli

auth login does not use refresh token to renew access token

Open
#738 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug domain/auth
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Describe the bug

After the access token expires (~2 hours), lark-cli requires re-authorization via device code flow, even though the refresh token is still valid (~7 days). The CLI appears to store the refresh token (as evidenced by auth status returning refreshExpiresAt) but never uses it to silently renew the access token.

To Reproduce

  1. lark-cli auth login --recommend
  2. Complete device code authorization in browser
  3. Wait ~2 hours for access token to expire
  4. Run any command (e.g. lark-cli auth status)
  5. Observe tokenStatus: needs_refresh and auth login demanding a new device code

Expected behavior

When the access token expires but the refresh token is still valid, lark-cli should:

  • Automatically exchange the refresh token for a new access token, OR
  • Provide an auth refresh subcommand to do so manually

Without this, users must re-authorize every 2 hours, which defeats the purpose of having a refresh token.

Environment

  • OS: macOS Sequoia (arm64)
  • lark-cli version: 1.0.23
  • Brand: feishu
  • Scope includes: offline_access

Additional context

The offline_access scope is already requested during login, so the refresh token should be available. The auth subcommands currently are: login, logout, status, check, scopes, list — there is no refresh command.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reproducing the expired-token behavior with lark-cli auth login --recommend, then inspect the auth handling used by auth status and the existing login flow. Trace how refreshExpiresAt and the refresh token are stored and checked. Done means a valid refresh token renews access automatically or an auth refresh command is available without repeating device-code authorization.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.