[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

  1. Install Claude Code (tried both npm install -g @anthropic-ai/claude-code and native installer)
  2. Run claude in project directory
  3. Run /login
  4. Select "1. Claude account with subscription"
  5. Complete OAuth flow in browser (shows "Login successful" and "You're all set up for Claude Code")
  6. Return to terminal - see "Login successful" message
  7. Try any command (e.g., "Are you there?")
  8. 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

View original on GitHub ↗

23 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5225
  2. https://github.com/anthropics/claude-code/issues/5166
  3. https://github.com/anthropics/claude-code/issues/5167

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

timyal · 11 months ago

Tested with multiple installation methods:

  • npm global installation: Same issue
  • Native installation with conflicts: Same issue
  • Clean, single native installation: Same issue

Latest claude doctor output (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.

timyal · 11 months ago

Downgrading to 1.0.67 also did not work for me...

Still Missing API key · Run /login

timyal · 11 months ago

Closing claude, and reopening did the trick AFTER the downgrade!!!

nodnarbnitram · 11 months ago
jacoblhess · 11 months ago

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?

vincent-herlemont · 11 months ago

I have the same issue with the 1.0.70 version. It's really annoying.

AFDudley · 11 months ago

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.

icaca · 11 months ago

same issue

AFDudley · 11 months ago

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.

NightMachinery · 11 months ago
❯ claude doctor

 Diagnostics
 └ Currently running: npm-global (1.0.72)
 └ Path: /opt/homebrew/Cellar/node/24.4.1/bin/node
 └ Invoked: /opt/homebrew/bin/claude
 └ Config install method: unknown
 └ Auto-updates enabled: true
 └ Update permissions: Yes

 Agent Configurations
 └ Loaded custom agents: 0

I get this Config install method: unknown, which might be the problem.

yplassiard · 10 months ago

I have the same issue whatever version I tried >1.0.67.
Would be nice to fix it, it's very annoying
thanks

coloboxp · 10 months ago

Same here, very annoying

MichaelDanielTom · 10 months ago

I had this issue for a while and it turned out to be that I had modified PATH in 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 previous PATH there, but it did.

So with the following line I kept getting the error, but removing the setting of PATH fixed it.

{
  "env": {
    "PATH": "$PATH:/Users/myuser/.venv/bin",
    ...
  },
  ...
}
potable-anarchy · 10 months ago

Been fighting this all day. None of the suggestions here worked for me.

However, this worked:
curl -fsSL https://claude.ai/install.sh | bash

From here: https://docs.anthropic.com/en/docs/claude-code/setup

YuanZongjian · 10 months ago
Been fighting this all day. None of the suggestions here worked for me. However, this worked: curl -fsSL https://claude.ai/install.sh | bash From 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!

svilupp · 9 months ago

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!

yplassiard · 9 months ago

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.

pythoninthegrass · 8 months ago
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

lmoreau · 8 months ago

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.

github-actions[bot] · 7 months ago

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.

github-actions[bot] · 6 months ago

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.

github-actions[bot] · 5 months ago

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.