Skip to content

[BUG] Claude code -p mode authentication does not work #1351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks
timoruokonen opened this issue May 27, 2025 · 0 comments
Open
4 tasks

[BUG] Claude code -p mode authentication does not work #1351

timoruokonen opened this issue May 27, 2025 · 0 comments
Labels
area:auth bug Something isn't working has repro platform:macos Issue specifically occurs on macOS

Comments

@timoruokonen
Copy link

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other: Just terminal on Mac using Claude Code
  • Claude CLI version: 1.0.3 (Claude Code)
  • Operating System: macOS 15.4.1
  • Terminal: Terminal App

Bug Description

"claude -p" mode does not authenticate although interactive mode is authenticated.

claude -p "test"                          
Invalid API key · Please run /login

I have done web site authentication for Claude Code interactive mode and it works just fine. Documentation (and claude 4) says that: "The -p mode should use the same authentication as interactive mode." but clearly it is not working. I have nothing authentication related in my .claude/settings.json.

Steps to Reproduce

  1. Run "claude /login"
  2. Follow the instructions and authenticate using the web method
  3. Ensure claude interactive mode is working by making any prompt
  4. Quite interactive mode
  5. Run "claude -p "test"

Expected Behavior

Claude Code would execute the test prompt

Actual Behavior

Claude Code responds with:
Invalid API key · Please run /login

Additional Context

It used to work with beta version although there were random authentication issues and I had to sometimes do the /login again which every time causes a new Claude Code API key to be generated.

@timoruokonen timoruokonen added the bug Something isn't working label May 27, 2025
@github-actions github-actions bot added has repro platform:macos Issue specifically occurs on macOS area:auth labels May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:auth bug Something isn't working has repro platform:macos Issue specifically occurs on macOS
Projects
None yet
Development

No branches or pull requests

1 participant