[BUG] macOS OAuth authentication succeeds but auth token not persisted - shows 'Missing API key' after successful login
Resolved 💬 23 comments Opened Aug 6, 2025 by timyal Closed Jan 13, 2026
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.69
- Operating System: macOS 15.5
- Terminal: Termius
Bug Description
OAuth authentication completes successfully but auth token is not persisted. After successful login with Claude Max subscription, Claude Code shows "Missing API key · Run /login" and /status shows "Auth Token: none".
Steps to Reproduce
- Install Claude Code (tried both npm install -g @anthropic-ai/claude-code and native installer)
- Run claude in project directory
- Run /login
- Select "1. Claude account with subscription"
- Complete OAuth flow in browser (shows "Login successful" and "You're all set up for Claude Code")
- Return to terminal - see "Login successful" message
- Try any command (e.g., "Are you there?")
- And you get "Invalid API key · Please run /login"
Expected Behavior
After successful OAuth authentication, Claude Code should store the auth token and allow normal usage with Claude Max subscription.
Actual Behavior
- OAuth completes successfully in browser
- Terminal shows "Login successful"
- Any command returns "Invalid API key · Please run /login"
- /status shows "Auth Token: none"
- No credentials found in macOS keychain or filesystem
- Issue persists across both npm and native installations
Additional Context
Have active Claude Max subscription
Tested with both npm global installation and native installer - same issue
No credential files created in ~/.claude/ directory
Multiple login attempts all show same behavior
claude doctor shows installation is healthy
Issue appears to be with credential storage/retrieval, not OAuth flow itself
23 Comments
Found 3 possible duplicate issues:
If your issue is a duplicate, please close it and 👍 the existing issue instead.
<sub>This issue will be automatically closed as a duplicate in 3 days if there are no additional comments. To prevent auto-closure, please 👎 this comment.</sub>
🤖 Generated with Claude Code
Tested with multiple installation methods:
Latest
claude doctoroutput (clean installation):Diagnostics
└ Currently running: native (1.0.69)
└ Path: /Users/timuryalcin/.local/bin/claude
└ Config install method: native
└ Auto-updates enabled: true
OAuth flow consistently works, but credentials are never persisted.
Downgrading to 1.0.67 also did not work for me...
Still Missing API key · Run /login
Closing claude, and reopening did the trick AFTER the downgrade!!!
https://github.com/anthropics/claude-code/issues/1222#issuecomment-3013457571 fixed it for me running on 1.0.69
I also downgraded to 1.0.67 to make it work. sorry for being a novice, but, how will we know when this is fixed? just follow this open bug?
I have the same issue with the 1.0.70 version. It's really annoying.
I have this issue with v1.0.71. after uninstalling and reinstalling multiple times it now works. I had the issue originally with just the npm installed version. I then install the native version still had the issue. Then I uninstalled and reinstalled both the npm version and the native version, leaving only the native version and this now appears to work. Seems more likely that there's invalid state in the install than any particular version actually being a part of the bug. Difficult to diagnose.
same issue
I thought I turned autoupdate off. It seems to have autoupdated anyway. The bug was reintroduced, I manually downgraded to 1.0.67 by remove .71 and .72 and then setting the symlink. .67 failed to login, but at some point it downloaded .72 and switched the symlink. I restarted my terminal. This feels like The Shining, .72 works. But it seems as though it requires failing via .67 at some point. Also I'm logging in a lot during this process.
I get this
Config install method: unknown, which might be the problem.I have the same issue whatever version I tried >1.0.67.
Would be nice to fix it, it's very annoying
thanks
Same here, very annoying
I had this issue for a while and it turned out to be that I had modified
PATHin my claude env in.claude/settings.json. I'm not sure why this caused an issue because it should have had the rest of the previousPATHthere, but it did.So with the following line I kept getting the error, but removing the setting of PATH fixed it.
Been fighting this all day. None of the suggestions here worked for me.
However, this worked:
curl -fsSL https://claude.ai/install.sh | bashFrom here: https://docs.anthropic.com/en/docs/claude-code/setup
Thanks, I have been troubled by this issue for half a month. your method works for me too!
Still unresolved. I haven't been able to login since v1.0.67.
None of the tips above work.
Other coding CLIs work perfectly fine, I've been using Codex much more because it works, but would love to see this fixed!
I may have successfuly fixed this doing the following, providing that I'm running from MacOS.
Potential root cause
It seems that Claude-code stores the credentials into the Session keychain. The thing is that in my setup, I'm running it via ssh so I'm not opening a "real" MacOS session, and therefore do not unlock the keychain, which leads to the error shown.
Solution
Use '''security unlock''' to unlock the desired keychain before invoking claude-code, and ideally when opening a session.
This worked for me too! Thanks @yplassiard
Same issue here had to file a chargeback with Amex as my Max plan renewed days ago and since then I have not been able to use it at all; nothing but endless /login loops.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.