CLI Authentication, the Right Way CLI authentication flows that rely on localhost redirects and browser availability fail in SSH sessions, containers, and WSL environments. The author argues that RFC 8252's OAuth pattern for native apps does not address headless hosts, and most vendor CLIs have not adopted device-code flow or other solutions since 2019. CLI Authentication, the Right Way https://www.abgeo.dev/blog/cli-authentication-the-right-way/ I SSH into a fresh dev VM and run claude to start a session in there. The CLI prints a login URL with http://localhost:54213/callback buried in the query string, tries to open a browser on the remote box, and starts waiting for a callback. There is no browser on this box. The CLI catches the failure, prints Paste code here if prompted , and hangs. I copy the URL into the browser on my laptop, log in, and the consent page hands me a one-time code instead of a redirect. I paste it back over SSH. It works. It is also 2009 wearing a 2026 t-shirt. This is a solved problem. It has been solved since 2019. Most CLIs still have not caught up. What most tools actually do what-most-tools-actually-do The pattern is everywhere. gcloud auth login , wrangler login , the older vercel login , and a long tail of vendor CLIs all run the same dance: - The CLI binds an HTTP server on 127.0.0.1 at some port. Wrangler picks 8976. gcloud uses 8085. Claude Code grabs an ephemeral one each invocation. - It opens your system browser to the OAuth authorization endpoint with redirect uri=http://127.0.0.1: