Skip to content

Add --output json to auth list and auth token, and --min-ttl to auth token - #29

Merged
edumansky merged 1 commit into
mainfrom
auth-json-min-ttl
Nov 17, 2026
Merged

edumansky merged 1 commit into
mainfrom
auth-json-min-ttl

Conversation

@edumansky

@edumansky edumansky commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

webex auth list and webex auth token can now print JSON, and auth token can make sure its token lasts long enough for the work it's handed to.

Webex Admin Studio runs both commands to get its users and tokens:

  • auth list --output json
  • auth token --user <email> --organization <org> --output json --min-ttl <n>s

Neither works on main, so Studio can't sign in with a current CLI. #20 added both, and they went with its revert.

Changes

  • auth list --output json prints one object per stored login, sorted by email. Each has email, name, orgId, orgName, status, default, readOnly and expiresAt. It never includes a token.
  • auth token --output json prints token, plus expiresAt and email when the token comes from a stored login, plus orgId.
  • auth token --min-ttl <duration> refreshes the stored token first when less than that time remains. It fails if even a fresh token wouldn't last that long. With --token or a token from the environment there's nothing to refresh, so --min-ttl is refused.
  • Only an explicit --output json switches to JSON. The flag's default is also json, so without it both commands print exactly what they print today.
  • The auth list table is now built from the same list as the JSON. It is sorted by email, which before was random map order.
  • New auth.EnsureMinTTL. It refreshes through the existing refreshStored, under the same lock that the other CLI processes use.
  • Docs: README and skill/SKILL.md.

This is #20's code for these two commands. #20's tidy-up of auth status and its auth status --output json are not included.

Checks

  • Tests first: TestAuthUsersAreSortedAndCarryState, TestTokenJSONOmitsUnknownExpiry, and three EnsureMinTTL tests (keeps, refreshes, refuses). They failed to compile before the change.
  • go vet ./... and go test -p 1 ./... pass. make codegen keeps the skill edit.
  • Field names match Studio's WebexUser and AccessToken structs (crates/studio-engine/src/webex_cli.rs).
  • Live, against a real stored login. Only field names and lengths were printed:
    • auth list --output json has the fields above and no token.
    • auth token --output json --min-ttl 30m has token, expiresAt, email and orgId.
    • auth token and auth list without the flags print as before, apart from the table's new sort order.
    • With WEBEX_TOKEN set, --min-ttl is refused, and --output json gives token and orgId.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…token

Programs that run the CLI for a user list and token need them in a form they
can parse, and a token that lasts as long as their work does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@edumansky edumansky left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex review (gpt-6-astra, reasoning effort: high)

No actionable defects were identified in the diff. The new command JSON tests passed; minimum-TTL tests and broader suites could not complete because the sandbox prohibits local test-server listeners.

@edumansky

Copy link
Copy Markdown
Contributor Author

Codex review: outcome

Codex (gpt-6-astra, reasoning effort: high) reviewed 04c7588 against main and found no issues, so there is no fix commit.

EnsureMinTTL tests and broader suites in Codex's run: these were environmental. Codex's sandbox can't open the local test server they use.

Elsewhere they pass:

  • CI on 04c7588 ran go build, go vet, go test ./... and the codegen tests. All passed.
  • Locally, go vet ./... and go test -p 1 ./... pass, including the three EnsureMinTTL tests.

🤖 Generated with Claude Code

@edumansky
edumansky merged commit 4cbce04 into main Nov 17, 2026
1 check passed
@edumansky
edumansky deleted the auth-json-min-ttl branch November 17, 2026 17:56
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.

1 participant