Skip to content

Let sigillo login sign in again when a token is already saved - #22

Merged
remorses merged 2 commits into
remorses:mainfrom
kldzj:pr/login-saved-token
Sep 29, 2026
Merged

remorses merged 2 commits into
remorses:mainfrom
kldzj:pr/login-saved-token

Conversation

@kldzj

@kldzj kldzj commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Problem

With a token already saved, sigillo login re-saves it and exits:

$ sigillo login
✔ Saved bearer token
Use this for CI or API-token-based secret access.

login saves whatever config.resolve returns, and that includes the token from ~/.sigillo/config.json. So a login that stopped working (an expired session, one ended on the server) can only be replaced after sigillo logout.

Fix

Only a token given with --token or SIGILLO_TOKEN is saved as is. Otherwise login starts the device flow.

Tests

  • A new e2e test writes a stale token into a temporary HOME and expects the device flow. It fails on main ("Saved bearer token") and passes here. It needs only the server URL, not a working login.
  • zig build test 74/74, pnpm --dir cli test 20/20 against a real instance.

login saved whatever config.resolve returned, and resolve includes the
token from ~/.sigillo/config.json. With a token saved, login re-saved it
and never started the device flow, even when that token had stopped
working. Only --token and SIGILLO_TOKEN are saved as given now.

The e2e test writes a stale token into a temporary HOME and expects the
device flow. It needs no working login, only the server URL.
@remorses

Copy link
Copy Markdown
Owner

can we make the zig build for these tests global instead of per describe block?

@kldzj

kldzj commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Done in 2f0af5a: zig build runs once, in a top-level beforeAll for the whole file, and both suites use that binary.

@remorses
remorses merged commit 01db7e0 into remorses:main Sep 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants