10 cards
API key / Personal Access Token (PAT)
A long-lived secret string the user pastes into the CLI; simple, but hard to revoke per session, easily leaked through shell history, and bypasses MFA/SSO.
Resource Owner Password Credentials (ROPC)
The CLI takes the username/password directly and exchanges them for a token; RFC 9700 (OAuth Security BCP) §2.4 says it MUST NOT be used because it exposes the password to the client and does not support MFA/SSO.
Loopback redirect + PKCE (RFC 8252)
The CLI opens a browser on the same machine and receives the authorization code via `http://127.0.0.1:{port}`; the best UX when the machine has a browser.
Device Authorization Grant (RFC 8628)
The CLI displays a code and the user confirms it in a browser on any device; used for headless machines, SSH, containers, TVs.
Workload identity / OIDC federation
A machine (CI, server) proves its identity with a token issued by the platform, with no user and no long-lived secret.
Criteria for choosing a flow
Is there a browser on the same machine, is there an interactive user, is MFA/SSO required, is per-session revocation required.
The line "Visit https://…/device?user_code=XXXX-XXXX"
The step that shows the user `verification_uri_complete` (or `verification_uri` + `user_code`).
The line "Waiting for authentication…"
The CLI is polling the token endpoint with the device_code `grant_type` and receiving `authorization_pending`.
The line "You are now signed in"
The token endpoint has returned an access token (and usually a refresh token), and the CLI has saved it to the credential store.
Headless fallback
The CLI uses loopback by default and switches to device flow when there is no browser, or via a forcing flag (DevCLI `--device`; AWS CLI, Azure CLI `--use-device-code`). `--no-browser` only stops the browser from opening automatically; it does not change the flow.