9 cards
Step 1
Call the device authorization endpoint and receive device_code, user_code, verification_uri, expires_in, interval.
Step 2
Print the user_code and URL, and try to open the browser with verification_uri_complete if present.
Step 3
Poll the token endpoint every `interval` seconds, adding 5 seconds each time `slow_down` is received.
Step 4
On receiving the token, save it to the keychain (fallback: 0600 file), then print the signed-in account.
Stop polling when
A token arrives, `access_denied`, `expired_token`, `expires_in` is exceeded, or the user presses Ctrl+C.
Never print the token to the terminal
Avoid leaks through scrollback, CI logs, screen sharing.
devcli whoami
Call the userinfo API with the access token and print the account, the selected team, and the credential source.
devcli logout
Revoke the refresh token on the server, then delete the local credential, even if revoke fails with a network error.
Respect corporate proxy and CA
The CLI should read standard proxy configuration so login works behind a firewall.