Skip to content

feat: Add login and logout subcommands for OAuth flows#773

Merged
atheriel merged 1 commit into
mainfrom
aj-login
May 29, 2026
Merged

feat: Add login and logout subcommands for OAuth flows#773
atheriel merged 1 commit into
mainfrom
aj-login

Conversation

@atheriel
Copy link
Copy Markdown
Contributor

Intent

Connect version 2026.02 and later supports dynamic OAuth client registration and the authorization code flow, which is a nice way to sidestep the need for API keys.

This commit wires up these flows to new login and logout subcommands. As a bonus, we store the resulting credentials in the system keyring -- when available -- for improved security.

As a secondary bonus: we also support the device code flow (via --use-device-code) if the Connect server advertises its support for it.

Indicators for the OAuth client and keyring use have also been added to the rsconnect list output.

Resolves #759.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Automated Tests

Unit tests are included.

Directions for Reviewers

You can test that it works against any recent Connect server:

$ uv run rsconnect login -s https://dogfood.team.pct.posit.it/
$ uv run rsconnect logout -s https://dogfood.team.pct.posit.it/

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.
  • I have run the rsconnect-python-tests-at-night workflow in Connect against this feature branch.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-29 17:58 UTC

@atheriel atheriel force-pushed the aj-login branch 3 times, most recently from 2b61c62 to 9c22808 Compare May 28, 2026 18:25
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6099 4694 77% 0% 🟢

New Files

File Coverage Status
rsconnect/oauth.py 71% 🟢
TOTAL 71% 🟢

Modified Files

File Coverage Status
rsconnect/api.py 77% 🟢
rsconnect/main.py 71% 🟢
rsconnect/metadata.py 85% 🟢
TOTAL 78% 🟢

updated for commit: 52351a7 by action🐍

@atheriel atheriel requested a review from zackverham May 28, 2026 20:02
Comment thread rsconnect/metadata.py Outdated
Comment thread rsconnect/oauth.py Outdated
Comment thread rsconnect/oauth.py
Comment thread tests/test_oauth.py Outdated
@zackverham
Copy link
Copy Markdown
Contributor

Question for my own understanding - I'm trying to follow what happens if they keyring isn't available. Is that fallback implemented in the keyring library? It looks like rsconnect-python is just calling keyring behavior and itself doesn't implement the fallback.

@atheriel
Copy link
Copy Markdown
Contributor Author

Question for my own understanding - I'm trying to follow what happens if they keyring isn't available.

If it isn't available then we store the tokens in the JSON file, like we do for API keys.

Connect version 2026.02 and later supports dynamic OAuth client
registration and the authorization code flow, which is a nice way to
sidestep the need for API keys.

This commit wires up these flows to new `login` and `logout`
subcommands. As a bonus, we store the resulting credentials in the
system keyring -- when available -- for improved security.

As a secondary bonus: we also support the device code flow (via
`--use-device-code`) if the Connect server advertises its support for
it.

Indicators for the OAuth client and keyring use have also been added to
the `rsconnect list` output.

Unit tests are included.

Closes #759.

Signed-off-by: Aaron Jacobs <[email protected]>
@atheriel atheriel merged commit 066d5de into main May 29, 2026
24 checks passed
@atheriel atheriel deleted the aj-login branch May 29, 2026 17:58
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.

rsconnect login using OAuth flow and DCR

2 participants