auth login does not use refresh token to renew access token
Nobody has claimed this yet.
- 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
lark-cli auth login --recommend- Complete device code authorization in browser
- Wait ~2 hours for access token to expire
- Run any command (e.g.
lark-cli auth status) - Observe
tokenStatus: needs_refreshandauth logindemanding 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 refreshsubcommand 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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