10 cards
Symptom "login succeeded but every command says Not authorized"
Usually the wrong account, wrong team/scope, or an outdated CLI, not a broken token.
Diagnostic step 1
Run `whoami` inside and outside the project directory; different results mean the project directory is forcing a scope.
Diagnostic step 2
Check which project/team the link file in the project directory points to, and whether the current account has access to it.
Diagnostic step 3
Upgrade the CLI, log out and log in again, and make sure the browser is signed in to the right account.
Diagnostic step 4
Check whether a token environment variable is overriding the stored credential; only check whether it is set, never print its value.
Good CLI error messages
State clearly which account and team are in use and which source they came from (flag, env, link file).
Server-side metrics
Rate of device codes expiring unused, deny rate, poll frequency, number of `slow_down` responses, time from code issuance to approval.
Phishing signals
Many codes approved from an IP/location far from the initiating IP, or a sudden spike in approvals for one client.
CLI auth spec review checklist
Which flow for which case, TTL and interval, user_code brute-force protection, where tokens are stored, whether logout revokes, what CI uses, whether error messages leak information.
STRIDE threat model for CLI login
Spoofing (code phishing, fake loopback callback), Tampering (modifying the link file `.devcli/project.json`), Repudiation (approval audit), Information disclosure (tokens on disk), DoS (poll flood), Elevation (overly broad scopes).