10 cards
Refresh before expiry
Refresh when the access token has less than about 60 seconds left, to compensate for clock skew and network latency.
Race when multiple CLI processes refresh
Two commands running in parallel use the same old refresh token; you need both single-flight (within a process) and a file lock plus re-reading the token after acquiring the lock (across processes).
Refresh token rotation + reuse detection
Each refresh returns a new refresh token; reusing an old one is treated as theft and the whole chain is revoked.
Credential precedence
`--token` > `DEVCLI_TOKEN` > profile selected by `--profile` > `DEVCLI_PROFILE` > `default`, like the AWS CLI credential chain.
Team precedence
`--team` > `DEVCLI_TEAM` > link file `.devcli/project.json` > the profile's default team; kept separate from the credential chain.
Profile and team
`--profile` selects the identity, `--team` selects where to operate; a link file in the project directory can auto-select a team the account has no access to.
Per-command scopes
Request only the scopes you need; sensitive commands may require requesting extra scopes or re-authenticating.
CI does not use device flow
There is no user to enter the code; use a CI token or OIDC federation.
OIDC federation in CI
For example, GitHub Actions issues an OIDC token and the cloud trusts it to issue short-lived credentials, with no secret stored in the repository.
Minimal CI token
Narrow scope, bound to a specific project/team, with an expiry date, rotated periodically.