Title: OAuth login succeeds but token is never written to macOS Keychain — persistent "Not logged in"
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After completing /login (both the automatic redirect and manual code-paste paths), the browser confirms success, but Claude Code immediately shows "Not logged in · Please run /login". Running security find-generic-password -s "Claude Code-credentials" -w right after a successful login returns SecKeychainSearchCopyNext: The specified item could not be found — the token is never written to Keychain, so login never persists.
What Should Happen?
After completing /login successfully (either via automatic browser redirect or by pasting the code back into the terminal), the OAuth token should be written to the macOS Keychain under the service name Claude Code-credentials and persist across sessions. security find-generic-password -s "Claude Code-credentials" -w should return the stored {"claudeAiOauth":...} credentials, claude doctor and /status should show the account as logged in, and Claude Code should work normally without repeatedly prompting for /login.
Error Messages/Logs
Steps to Reproduce
Run claude, then /login
Complete authentication in the browser (tried both auto-approve and manual code paste)
Exit Claude Code (/exit)
Run security find-generic-password -s "Claude Code-credentials" -w
Result: could not be found — token was never stored. Reopening Claude shows "Not logged in".
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.200
Claude Code Version
2.1.201
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_