Skip to content

token#

Print the OAuth access token stored by 'rsconnect login' for a Posit Connect server, so other tools can make API requests as you with 'Authorization: Bearer '.

The token is printed as is, without contacting the server. When the server rejects it with a 401, run the command again with --refresh to get a new one, then retry the request. Concurrent refreshes are safe: if another process has already refreshed, its token is printed.

Only tokens from 'rsconnect login' are printed, never API keys. The command never prompts.

Output: the bare token, or with --format json an object with the keys access_token, token_type ("Bearer"), and server. Nothing is printed on stdout on failure.

Exit status: 0 on success; 4 when you need to log in again (no stored OAuth credentials, or the server rejected them); 1 for other errors, such as an unreachable server.

Usage:

token [OPTIONS]

Options:

  -n, --name TEXT       The nickname of the Posit Connect server.
  -s, --server TEXT     The URL of the Posit Connect server.
  --refresh             Get a new access token, after the server rejected the
                        current one.
  --format [text|json]  Print the bare token, or a JSON object.  [default:
                        text]
  --help                Show this message and exit.