Skip to content

Commit f10f74c

Browse files
authored
docs: recommend rsconnect login for Posit Connect (#919)
1 parent 57ebe7b commit f10f74c

3 files changed

Lines changed: 50 additions & 35 deletions

File tree

‎README.md‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ python -m pip install rsconnect-python
2424

2525
## Usage with Posit Connect
2626

27-
[Get an API key from your Posit Connect server](https://docs.posit.co/connect/user/api-keys/) with at least publisher privileges:
28-
29-
Store your credentials:
27+
Log in to your Posit Connect server:
3028

3129
```bash
32-
rsconnect add --server https://connect.example.com --api-key <YOUR-CONNECT-API-KEY> --name production
30+
rsconnect login https://connect.example.com
3331
```
3432

3533
Deploy your application:
@@ -38,6 +36,16 @@ Deploy your application:
3836
rsconnect deploy shiny app.py --title "my shiny app"
3937
```
4038

39+
Browser login requires Posit Connect 2026.02.0 or later. In remote containers,
40+
or other sessions where the browser cannot reach the CLI's local callback, use
41+
`--use-device-code` with Connect 2026.06.0 or later.
42+
43+
For older servers, or automation that cannot use identity tokens, [get an API
44+
key](https://docs.posit.co/connect/user/api-keys/) and store it with
45+
`rsconnect add`.
46+
See the [authentication guide](https://docs.posit.co/rsconnect-python/#managing-server-information)
47+
for identity token requirements and other login options.
48+
4149
[Read more about publisher and admin capabilities on the docs site.](https://docs.posit.co/rsconnect-python)
4250

4351
## Usage with Posit Connect Cloud

‎docs/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Getting-started documentation recommends `rsconnect login` for Posit Connect,
11+
with API keys as an alternative.
1012
- `rsconnect token` prints the OAuth access token stored by `rsconnect login` for a
1113
Posit Connect server, so other tools, such as the Connect SDKs, can make API
1214
requests with your login. `--refresh` gets a new token after the server rejects

‎docs/index.md‎

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@ pip install git+https://github.com/posit-dev/rsconnect-python.git
2727

2828
### Using the rsconnect CLI
2929

30-
Here's an example command that deploys a Jupyter notebook to Posit Connect.
30+
Log in to Posit Connect, then deploy a Jupyter notebook:
3131

3232
```bash
33-
rsconnect deploy notebook \
34-
--server https://connect.example.org \
35-
--api-key my-api-key \
36-
my-notebook.ipynb
33+
rsconnect login https://connect.example.org
34+
rsconnect deploy notebook my-notebook.ipynb
3735
```
3836

3937
> **Note**
4038
> The examples here use long command line options, but there are short
41-
> options (`-s`, `-k`, etc.) available also. Run `rsconnect deploy notebook --help`
39+
> options available also. Run `rsconnect deploy notebook --help`
4240
> for details.
4341
4442
### Setting up `rsconnect` CLI auto-completion
@@ -75,48 +73,55 @@ compinit
7573

7674
### Managing Server Information
7775

78-
The information used by the `rsconnect` command to communicate with a Posit Connect
79-
server can be tedious to repeat on every command. To help, the CLI supports the idea
80-
of saving this information, making it usable by a simple nickname.
81-
82-
> **Warning**
83-
> One item of information saved is the API key used to authenticate with
84-
> Posit Connect. Although the file where this information is saved is marked as
85-
> accessible by the owner only, it's important to remember that the key is present
86-
> in the file as plain text so care must be taken to prevent any unauthorized access
87-
> to the server information file.
76+
The CLI can save Posit Connect server information under a nickname, so you don't
77+
need to repeat it on every command.
8878

8979
#### Remembering Server Information
9080

91-
Use the `add` command to store information about a Posit Connect server:
81+
Use `login` to authenticate and save a server:
9282

9383
```bash
94-
rsconnect add \
95-
--api-key my-api-key \
96-
--server https://connect.example.org \
97-
--name myserver
84+
rsconnect login https://connect.example.org
9885
```
9986

100-
> **Note**
101-
> The `rsconnect` CLI will verify that the serve URL and API key
102-
> are valid. If either is found not to be, no information will be saved.
87+
Browser login requires Posit Connect 2026.02.0 or later. In Posit Workbench,
88+
remote containers, or other sessions where the browser cannot reach the CLI's
89+
local callback, use `--use-device-code`; this requires Connect 2026.06.0 or later.
90+
The `--no-wait` device flow also requires Connect 2026.06.0 or later.
10391

104-
If any of the access information for the server changes, simply rerun the
105-
`add` command with the new information and it will replace the original
106-
information.
92+
For automation, `--identity-token` and `--identity-token-file` require Connect
93+
2026.08.0 or later, or Connect 2026.02.0 or later with identity federation.
10794

108-
Once the server's information is saved, you can refer to it by its nickname:
95+
Login sets the server as the default unless `--no-set-default` is supplied.
96+
Later commands can use that default:
10997

11098
```bash
111-
rsconnect deploy notebook --name myserver my-notebook.ipynb
99+
rsconnect deploy notebook my-notebook.ipynb
112100
```
113101

114-
If there is information for only one server saved, this will work too:
102+
See the [`login`](commands/login.md), [`logout`](commands/logout.md), and
103+
[`token`](commands/token.md) references for more options.
104+
105+
As an alternative for servers older than Connect 2026.02.0 or automation that
106+
cannot use identity tokens, [create an API key](https://docs.posit.co/connect/user/api-keys/)
107+
and save it with `add`:
115108

116109
```bash
117-
rsconnect deploy notebook my-notebook.ipynb
110+
rsconnect add \
111+
--server https://connect.example.org \
112+
--api-key my-api-key \
113+
--name myserver
118114
```
119115

116+
You can also pass `--api-key` or set `CONNECT_API_KEY` on individual commands.
117+
The CLI verifies the server URL and API key before saving them.
118+
119+
> **Warning**
120+
> Saved API keys are stored as plain text in the server information file.
121+
> The file is accessible only by its owner; protect it from unauthorized access.
122+
> See [Stored Information Files](deploying.md#stored-information-files) for
123+
> OAuth token storage.
124+
120125
#### Listing Server Information
121126

122127
You can see the list of saved server information with:

0 commit comments

Comments
 (0)