Skip to content

Explain that client credentials cannot publish to SSO accounts - #868

Open
vrsarah wants to merge 5 commits into
mainfrom
connect-cloud-sso-credentials-error
Open

vrsarah wants to merge 5 commits into
mainfrom
connect-cloud-sso-credentials-error

Conversation

@vrsarah

@vrsarah vrsarah commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Intent

When an account requires single sign-on (SSO), Posit Connect Cloud does not grant publish permission to tokens without a recent SSO login. Client credentials tokens never have one. Publishing with client credentials to such an account now reports this, instead of a generic missing-permission error. The check uses the sso_enabled and role fields that GET /v1/accounts already returns.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

When an account is visible but lacks content:create, and the saved credential is a service account (client ID and secret), ConnectCloudClient._publishable checks sso_enabled and whether role is owner, admin, or publisher. If both hold, it raises an error saying the account requires SSO. Other cases keep the existing message. ConnectCloudAccount gains the optional role and sso_enabled keys.

Automated Tests

Added a test in tests/test_connect_cloud.py: a service account on an SSO account with the publisher role gets the SSO message; the viewer role keeps the existing message; an interactive login does not get the service-account message.

Directions for Reviewers

Run uv run --group test pytest -q tests/test_connect_cloud.py.

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

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/rsconnect-python/pr-preview/pr-868/

Built to branch gh-pages at 2026-10-16 21:44 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10893 9540 88% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/api.py 89% 🟢
rsconnect/connect_cloud.py 98% 🟢
rsconnect/main.py 84% 🟢
rsconnect/metadata.py 90% 🟢
TOTAL 90% 🟢

updated for commit: bd31a92 by action🐍

@vrsarah
vrsarah requested review from karawoo and samperman October 15, 2026 18:17
Comment thread docs/CHANGELOG.md Outdated
## Unreleased

- Publishing to a Posit Connect Cloud account that requires single sign-on (SSO) with
service account credentials now explains that SSO blocks the publish, instead of

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service account?

@vrsarah vrsarah Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like that's how we refer to these client credentials in rsconnect-python ("service account credential") 🤔 for example,

For non-interactive use such as CI, pass a service account credential with
`--client-id` and `--client-secret`, or the `CONNECT_CLOUD_CLIENT_ID` and
`CONNECT_CLOUD_CLIENT_SECRET` environment variables.

But I think the term is a bit misleading, since these credentials act as the user who created them. I'll change the new wording to "client credentials" and update the existing references in a follow-up

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge #869 into this branch if you agree with the idea 🙂

vrsarah and others added 3 commits October 15, 2026 15:24
* docs: call Connect Cloud client ID and secret client credentials

* docs: drop changelog entry for the client credentials wording
…dentials-error

# Conflicts:
#	docs/CHANGELOG.md

This branch has not been deployed

No deployments
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.

2 participants