From 7c13f208c4d568bce6e79e27b54a2160b7af9a78 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Fri, 13 Nov 2026 17:08:39 -0500 Subject: [PATCH] chore: guard and document the connect token command Add token to EXPECTED_RSCONNECT_COMMANDS so an upstream rename or removal fails the test suite, and describe posit connect token in the README. Refs #21 Co-Authored-By: Claude Opus 5.5 --- README.md | 11 +++++++++++ tests/test_cli.py | 1 + 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 3abfc0c..70cf1de 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,17 @@ keyring; `posit connect api` and the deploy commands reuse those credentials automatically (including token refresh). You can also point at a server ad hoc with `--server`/`CONNECT_SERVER` and `--api-key`/`CONNECT_API_KEY`. +Other tools, such as the Connect SDKs or `curl`, can use the same login through +`posit connect token`, which prints the stored access token: + +```console +$ curl -H "Authorization: Bearer $(posit connect token)" https://connect.example.com/__api__/v1/user +``` + +If the server rejects the token, run `posit connect token --refresh` to get a +new one. `--format json` prints machine-readable output. Exit status 4 means +there are no usable credentials and you need to run `posit connect login` again. + ## `posit connect api` A `gh api`-style raw REST client, authenticated with your saved credentials. diff --git a/tests/test_cli.py b/tests/test_cli.py index 4e152ba..707f62a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -33,6 +33,7 @@ def test_connect_mounts_api_command(runner): "bootstrap", "login", "logout", + "token", ]