Claude CLI Login 101 · Lesson 4

Real proof and prevention

Validate state, protected storage, and a real request.

By the end
1

The big idea

Working means three signals together: loggedIn true, mode 600, and a real model request that responds.

Think of it like… It is trying the key in the real door, not just checking whether it looks new.

A real request crosses authentication, persistence, and service access, so it is the strongest final proof.

2

In one picture

Chrome OAuthCallbackCredentialauth statusReal request
After: every boundary reaches the real request.
3

Try it

claude -p 'Reply exactly: CLAUDE_LOGIN_OK' --output-format text
CLAUDE_LOGIN_OK

Remember: A screen is a clue; the command is proof.

Quick check

What is the strongest final proof?

Use evidence that crosses the real boundary without exposing a secret.

10

Ten rules

The Part of Tens
  1. Status beats screens
  2. Never print tokens
  3. Use official logout
  4. Do not delete ~/.claude
  5. CAPTCHA is manual
  6. Check mode 600
  7. Make a real request
  8. Separate auth from network
  9. Compare before/after
  10. Stop when it converges