claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code Login Authentication Not Persisting for Subscriber Users on remote SSH in MAC

Open achank89 opened this issue 1 year ago • 4 comments

Issue Summary

Claude Code successfully completes login flow but immediately shows "Missing API key" error, preventing subscriber users from using the tool. The authentication token is not being persisted after successful login.

Environment

  • OS: macOS (Apple Silicon)
  • Claude Code Version: v1.0.69
  • Node Version: v24.5.0 (via NVM)
  • Installation Method: npm global (@anthropic-ai/claude-code)
  • User Type: Claude.ai subscriber (not API key user)

Bug Description

  1. Run claude command to start Claude Code
  2. Execute /login command
  3. Browser authentication completes successfully
  4. Terminal shows "Login successful" message
  5. Immediately after, Claude Code shows "Missing API key · Run /login" error
  6. /status command shows Auth Token: none despite successful login

Expected Behavior

After successful login, the authentication token should be persisted and the user should be able to use Claude Code without seeing "Missing API key" errors.

Actual Behavior

/login ⎿ Login successful ╭───────────────────────────────────────────────────╮ │ ✻ Welcome to Claude Code! │ │ │ │ /help for help, /status for your current setup │ │ │ │ cwd: /[REDACTED]/mobile-apps/temp │ ╰───────────────────────────────────────────────────╯ ? for shortcuts Missing API key · Run /login

Status Output

Claude Code v1.0.69 L Session ID: [REDACTED] Working Directory L /[REDACTED]/mobile-apps/temp System Diagnostics • /doctor ⚠ Config mismatch: running npm-global but config says npm-global Account L Auth Token: none Model • /model L Default (claude-sonnet-4-20250514)

Steps Taken to Troubleshoot

1. Complete System Cleanup

  • Removed all Claude-related directories system-wide:
    sudo find / -type d \( -name ".claude" -o -name "claude" -o -name ".anthropic" -o -name ".claude-artifacts" \) -exec rm -rf {} +
    
    

Cleared all config directories: bashrm -rf ~/.claude* rm -rf ~/.config/claude* rm -rf ~/.local/share/claude* rm -rf ~/.cache/claude* rm -rf ~/Library/Application\ Support/claude*

  1. Reinstallation Attempts

Uninstalled and reinstalled via npm: bashnpm uninstall -g @anthropic-ai/claude-code npm install -g @anthropic-ai/claude-code

Attempted installation via Homebrew Cask

  1. Configuration Attempts

Tried setting install method: claude config set --global installMethod npm-global Attempted to create manual config files in various locations Checked and fixed directory permissions

  1. Login Method Variations

Standard login: /login Force login: /login --force No-browser login: /login --no-browser Attempted /auth command (but user is subscriber, not API key user)

  1. Environment Checks

Verified no conflicting environment variables Checked for multiple Claude installations Removed old Node.js versions via NVM Cleared npm cache

Additional Information

The "Config mismatch" warning shows identical values ("running npm-global but config says npm-global") Authentication appears to complete successfully in the browser The issue persists across terminal restarts and system reboots No error messages are shown during the login process

Reproduction Steps

Install Claude Code via npm: npm install -g @anthropic-ai/claude-code Run claude Execute /login Complete browser authentication Observe "Auth Token: none" in /status despite successful login

achank89 avatar Aug 06 '25 08:08 achank89

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5118
  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.

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.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 06 '25 08:08 github-actions[bot]

Hey, this is still not working for me

zein1016 avatar Aug 10 '25 16:08 zein1016

Solution here https://github.com/anthropics/claude-code/issues/1222#issuecomment-3164503563

geryit avatar Aug 10 '25 17:08 geryit

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.

github-actions[bot] avatar Aug 18 '25 14:08 github-actions[bot]