Skip to content

feat(cli): add streamlined path auth login --token#116

Closed
benbaarber wants to merge 1 commit into
mainfrom
ben/path-auth-streamline
Closed

feat(cli): add streamlined path auth login --token#116
benbaarber wants to merge 1 commit into
mainfrom
ben/path-auth-streamline

Conversation

@benbaarber

@benbaarber benbaarber commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Adds a browser-free way to authenticate the CLI: path auth login --token <token>. When you're already signed in on the Pathbase site, it can hand you a single ready-to-paste command instead of the open-browser → copy-8-char-code → redeem dance. The existing code flow is unchanged.

  • The token is the bearer credential directly (no redeem round-trip). The CLI validates it via GET /api/v1/users/me before writing anything, so a bad/expired token fails fast and never leaves a half-written session on disk. On success it stores the same credentials.json (0600) the code flow produces.
  • --token conflicts with --code. --url (→ $PATHBASE_URLhttps://pathbase.dev) works with both flows. The interactive prompt now also points already-signed-in users at the one-line token command.
  • 4 new integration tests (help lists --token; token/code conflict; mock /users/me drives a successful login persisted for auth status; rejected 401 errors and leaves no session). Full path-cli suite + clippy green.
  • Bumps path-cli 0.14.0 → 0.15.0.

The token-issuing UI is a Pathbase-site change (separate repo); this CLI side accepts whatever bearer token that page displays.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Adds a browser-free way to authenticate the CLI. When already signed in
on the Pathbase site, the user can copy a single ready-to-paste
`path auth login --token <token>` command instead of doing the
open-browser / copy-8-char-code / redeem dance.

The token is the bearer credential directly (no redeem round-trip). The
CLI validates it via GET /users/me before writing anything, so a bad or
expired token fails fast and never leaves a half-written session on disk.
`--token` conflicts with `--code`; the interactive prompt now also
points users who are already signed in at the one-line token command.

Bumps path-cli 0.14.0 -> 0.15.0.
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://e9587d4f.toolpath.pages.dev

@benbaarber

Copy link
Copy Markdown
Collaborator Author

Abandoning: the grant code already redeems through the existing --code flag (POST /api/v1/auth/cli/redeem), so a dedicated flag isn't needed. The site can just emit path auth login --code <grant>.

@benbaarber benbaarber closed this Jul 1, 2026
@ben-emp ben-emp deleted the ben/path-auth-streamline branch July 1, 2026 19:36
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