/login and /logout commands are not available (v1.0.11)

Resolved 💬 21 comments Opened Jun 4, 2025 by zacsims Closed Jan 17, 2026
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

My installation does not seem to pickup the /login or /logout commands. I have tried reinstalling and clearing cache but the problem persists.

!Image

View original on GitHub ↗

21 Comments

ant-kurt collaborator · 1 year ago

Check /status command. In the following cases /login is disabled:

  • Specifying env vars ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN
  • Setting the apiKeyHelper
  • Bedrock or Vertex provider
Custom156 · 1 year ago

I'm having a similar issue, where the code sent by mail is not working to login to my Max sub:

!Image

Edit: after about 10 minutes it worked...

zacsims · 1 year ago

I unset ANTHROPIC_API_KEY and reinstalled and now I am facing the same error as @Custom156

edit: seems to have worked after a few tries

farouqaldori · 1 year ago

Make sure to clear any local environment variables containing Anthropic keys. If it still doesn't work, check that you're not running it inside tmux. I had to exit the terminal completely and re-run the claude command.

ant-kurt collaborator · 1 year ago

Going to close this one out since it's working - if you have suggestions on how to streamline this experience (making it more clear that API keys are in use etc), please continue to comment!

ant-kurt collaborator · 1 year ago

See above for workarounds.

This change was made to reduce confusion when external API keys or auth tokens are provided, but clearly this is causing more confusion! We're looking into restoring the commands and having them describe why they're unavailable, rather than just removing the commands wholesale.

To workaround this for now: make sure you are not providing an ANTHROPIC_API_KEY env var to the Claude Code process, it will disable /login and /logout. We have an update in the next release that will make those commands only be disabled if the API key is provided AND approved in interactive mode (vs now, where the key doesn't have to be approved).

ant-kurt collaborator · 1 year ago

This issue was introduced in v1.0.11, as we started to look at ANTHROPIC_API_KEY environment variable as a source of auth for Claude Code. This caused some commands (/login, /logout, /install-github-app) to be unavailable if a key was detected, with the intention of reducing conflicts (e.g. you cannot "log out" from an API key provided via env var).

Workarounds

Short-term fixes

  • v1.0.12 will introduce a requirement for API key approval for the key to be used (and thus the commands to be unavailable). If you intend to use claude.ai auth (like Max) or a Console API login, you'll want to reject the API key specified on the environment.
  • If this causes issues with your usage of -p mode, you'll want to temporarily pin to v1.0.10

Longer term
We're open to feedback on how best to serve both externally specified API keys for Claude Code (https://github.com/anthropics/claude-code/issues/1651) and developers who may have an API key on their environment for non-Claude Code purposes.

Input like https://github.com/anthropics/claude-code/issues/1615#issuecomment-2945712114 and https://github.com/anthropics/claude-code/issues/1618#issuecomment-2944312942 is valuable!

How do folks feel about these options?

  1. /login and /logout are always available, and "error out" if external auth source exists
  2. /login and /logout are always available, and external auth sources (API key and auth token) now show as another choice, if present on the environment (likely excluding policies.json)
  3. Commands are hidden but info banner displays what auth source is being used
paskal · 1 year ago

Second option seems to be the most intuitive. Hiding the commands conditionally is unexpected and confusing, and an error during the command run explaining what's wrong would be better.

My scenario is getting oauth error after subscription expired, and given no option to login, while the /status shown I'm logged in and didn't show information about API key - it's likely shown only in /config. Confusing part was that everything worked with subscription before, and after the error popped up the API key was affecting lack of /login and /logout but was not used to serve requests, and moreover I would be unpleasantly surprised it it would start to be used silently after my subscription died.

So the current behaviour around the API key (don't use it when login is active) is good and expected, only the lack of commands was not.

kanelincoln · 1 year ago
Second option seems to be the most intuitive. Hiding the commands conditionally is unexpected and confusing, and an error during the command run explaining what's wrong would be better. My scenario is getting oauth error after subscription expired, and given no option to login, while the /status shown I'm logged in and didn't show information about API key - it's likely shown only in /config. Confusing part was that everything worked with subscription before, and after the error popped up the API key was affecting lack of /login and /logout but was not used to serve requests, and moreover I would be unpleasantly surprised it it would start to be used silently after my subscription died. So the current behaviour around the API key (don't use it when login is active) is good and expected, only the lack of commands was not.

Seconded; option two is best.

dmwyatt · 1 year ago

There seems to be some interaction with Bedrock configuration as well? I've unset CLAUDE_CODE_USE_BEDROCK, but I still get API Provider: AWS Bedrock in /status and I can't use /login or /logout.

JRC-knows · 1 year ago
There seems to be some interaction with Bedrock configuration as well? I've unset CLAUDE_CODE_USE_BEDROCK, but I still get API Provider: AWS Bedrock in /status and I can't use /login or /logout.

same error

ant-kurt collaborator · 1 year ago

Using Bedrock or Vertex does hide the login and logout commands. If you did unset CLAUDE_CODE_USE_BEDROCK then /status should not show that - can you confirm the env var is '' or not defined, and no other sources of config are specifying it? https://docs.anthropic.com/en/docs/claude-code/settings#settings-precedence

haranrk · 1 year ago

@ant-kurt Earlier, setting CLAUDE_CODE_USE_BEDROCK to 0 or 1 allowed me to switch between the two. But now, it always authenticates via bedrock, and I have not been able to resolve it.

Here are my settings based on settings precedence.

Enterprise policies (see IAM documentation)

Nothing set

Command line arguments

Starting with just claude

Local project settings

{
  "permissions": {
    "allow": [
      "WebFetch(domain:culturedcode.com)",
      "Bash(mkdir:*)",
      "Bash(python:*)"
    ],
    "deny": []
  }
}%

Shared project settings

None

User settings

Empty

Env Variables

export CLAUDE_CODE_USE_BEDROCK=0
export ANTHROPIC_MODEL='us.anthropic.claude-opus-4-20250514-v1:0'
export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-haiku-20240307-v1:0'
export AWS_REGION=us-west-2
export AWS_PROFILE=bedrock-profile
export DISABLE_PROMPT_CACHING=0

Steps taken to resolve

  1. rm ~/.claude.json
  2. rm -r ~/.claude
zpv · 1 year ago

Hey team, I can confirm this is still an issue on 1.0.51 (Claude Code). I was able to temporarily fix this issue by manually installing an older version npm i -g @anthropic-ai/claude-code@1.0.24 and wiping .claude/ and .claude.json

pkeir · 12 months ago

I have the ANTHROPIC_API_KEY env var set. When I run Claude Code (i.e. claude (version 1.0.55)), I get the message:

⚠Auth conflict: Using ANTHROPIC_API_KEY instead of Anthropic Console key. Either 
  unset ANTHROPIC_API_KEY, or run `claude /logout`.

I run claude /logout and so log out. I then run claude; it asks me to choose a login method (1 or 2), and I choose 2 (Anthropic Console account (API usage billing)). It opens my browser to log me in. Claude Code says that login was successful and I click Enter. I am asked if I want to use the ANTHROPIC_API_KEY or not (the latter is recommended). I choose to use the ANTHROPIC_API_KEY, and Claude Code shows only "Welcome to Claude Code". I exit with CTRL+C twice.

I know I can unset ANTHROPIC_API_KEY, or select not to use it, but if it can't work using ANTHROPIC_API_KEY, perhaps the option to use it shouldn't be presented; and this variable should otherwise be ignored (with a message indicating that it has been ignored) ?

ksquarekumar · 11 months ago

This is still an issue for me as well

nazrdogan · 11 months ago

+1

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.

FrancescoSaverioZuppichini · 7 months ago

unsetting all the vars worked

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.