[BUG] OAuth credentials not persisted to Keychain — only mcpOAuth stored, auth token missing

Resolved 💬 3 comments Opened Mar 20, 2026 by luc-anise Closed Mar 24, 2026

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 running claude login (OAuth flow completes successfully), the Keychain entry Claude Code-credentials is created but only contains mcpOAuth data (MCP server OAuth tokens like Notion). The actual Anthropic auth/OAuth token is not stored.

This means every new session starts with "Not logged in · Please run /login" — the credential never persists across sessions.

Diagnostic details:

# Keychain entry exists
$ security find-generic-password -s "Claude Code-credentials"
# → Found, account: "lucanis", created today

# But the stored data only has mcpOAuth
$ security find-generic-password -s "Claude Code-credentials" -w | xxd -r -p | python3 -c "import sys,json; print(json.dumps(list(json.load(sys.stdin).keys())))"
# → ["mcpOAuth"]

No ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN set in environment or shell config. No .credentials.json in ~/.claude/. Keychain is unlocked and writable (verified by successfully writing/deleting a test entry).

What Should Happen?

claude login should persist the OAuth/auth token to the Keychain entry alongside mcpOAuth, so new sessions automatically authenticate without requiring /login each time.

Steps to Reproduce

  1. Fresh macOS, native installer (not brew/npm)
  2. claude logout
  3. claude login — complete OAuth flow in browser
  4. Session works, shows authenticated
  5. Exit and start a new session → "Not logged in · Please run /login"
  6. Inspect Keychain: security find-generic-password -s "Claude Code-credentials" -w → only contains mcpOAuth

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

v2.1.80 (native installer at ~/.local/share/claude/versions/2.1.80)

Platform

macOS (Darwin 25.3.0)

Operating System

macOS

Terminal/Shell

ghostty / zsh

Related Issues

  • #36769 — subscriptionType: null despite active subscription (similar root cause?)
  • #32698 — Constant re-login required
  • #30178 — Persistent session auth failures

Additional Information

  • Installation method: Native installer (symlink ~/.local/bin/claude~/.local/share/claude/versions/2.1.80)
  • Keychain: login.keychain-db, unlocked, no timeout
  • Read/write to Keychain works fine for other entries
  • User switches between API key and subscription auth — neither persists

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗