Two-step device code login for environments that cannot wait for approval (login and add --connect-cloud)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- authentication, cli
Direzione di ricerca
Start by reading the CLI entry points for rsconnect login and rsconnect add --connect-cloud, then trace the device-code polling and credential-storage flows named in the issue. Determine how pending state can be stored with owner-only permissions and resumed safely; done means both targets support a machine-readable start/finish flow that preserves valid codes and removes expired or denied ones.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Some agent environments run each shell command as a short call. Claude Cowork is one example:
- A call ends after about 3 minutes.
- The agent sees the output only when the call ends.
- Child and background processes stop when the call ends.
rsconnect login --use-device-code and rsconnect add --connect-cloud print the verification URL and code, then poll for approval in the same process.
In these environments, the agent sees the code only after the call ends, which is too late to show it to the user.
The polling process then stops, so the login can never finish.
The device code flow is the correct flow for these environments, because it needs no localhost callback.
#842 asks rsconnect to fall back to the device code flow when the browser callback fails.
This issue asks for the next step: a device code login that works when the CLI cannot wait for approval.
Requested behavior
Split the device code flow into two commands. Each command exits immediately, or after a bounded wait.
# Posit Connect
rsconnect login https://connect.example.com --use-device-code --no-wait
# prints the verification URL and user code, saves the pending login, exits
rsconnect login --finish [--timeout 120]
# polls for up to --timeout seconds, then saves the credential like a normal login
# Posit Connect Cloud
rsconnect add --connect-cloud --account myteam --name cloud --no-wait
rsconnect add --finish [--timeout 120]
The flag names are only suggestions. Requirements:
- Save the pending login in the rsconnect-python config directory with owner-only permissions (0600). Never print the device code.
- If
startruns again for the same target while a code is still valid, print the same link and code. Do not request a new code. - Make the result machine-readable, for example a status word on the first line or distinct exit codes: pending (run finish again), failed (start again), or done.
- Keep the pending login while the code is still valid. Remove it when the code expires or the user denies it.
- Support both Posit Connect (
login) and Posit Connect Cloud (add --connect-cloud).
Current workaround
We ship helper scripts in a Posit deploy skill for Claude Cowork that do this split with rsconnect-python internals.
For Posit Connect, they use rsconnect.oauth._poll_for_device_token, _unwrap_json_response, discover_oauth_metadata, register_client, keyring_store_token, and ServerStore.set.
For Posit Connect Cloud, they also use connect_cloud.urls, connect_cloud.client_id, connect_cloud.SCOPE, and connect_cloud.store_credentials_in_keyring.
The scripts work with 1.31.1, but private functions can change in any release.
A supported mode would let us remove the scripts.
The R rsconnect::connectCloudUser() has the same problem, but that belongs in the R package.
- Lingua principale
- Python
- Stelle
- 38
- Fork
- 28
- Merge medio
- 10h 32m
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di posit-dev/rsconnect-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
posit-dev/rsconnect-python#786 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
posit-dev/rsconnect-python#543 · 2 commenti ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
posit-dev/rsconnect-python#513 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
posit-dev/rsconnect-python#178 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
posit-dev/rsconnect-python#857 ·
Tutte le issue di posit-dev/rsconnect-python
Issue simili
-
SSM GetParameter throttling during concurrent workflow launchesForse già presa @alexiswl l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
-
[Bug] Dev image build fails: `npm install` in the root Dockerfile runs out of memory (exit 134)Forse già presa @andest01 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Rename FunctionalRole BOT_DEV to DEV_STAFFForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
pesu-dev/discord_bot#97 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
gradio-app/gradio#13964 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno