/login does not switch accounts when already logged in

Resolved 💬 8 comments Opened Feb 7, 2026 by ratsch Closed May 25, 2026

Bug Description

Running /login while already logged in to one account does not switch to a different account. The login flow appears to complete successfully ("Login successful"), but ~/.claude.json retains the original oauthAccount and the session continues using the old account.

Steps to Reproduce

  1. Start Claude Code while logged in to Account A (e.g., personal Max plan)
  2. Run /login
  3. Select Account B (e.g., a Teams/Standard account)
  4. Login reports "Login successful"
  5. Check ~/.claude.jsonoauthAccount still shows Account A
  6. All subsequent CLI operations (including claude -p subprocess calls) continue using Account A

Expected Behavior

/login should overwrite the oauthAccount in ~/.claude.json with the newly selected account and switch the active session to use it.

Workaround

Manually remove the oauthAccount key from ~/.claude.json before running /login:

python3 -c "import json; d=json.load(open('$HOME/.claude.json')); d.pop('oauthAccount',None); json.dump(d, open('$HOME/.claude.json','w'), indent=2)"

Then /login prompts for account selection as expected.

Environment

  • Claude Code version: 2.1.34
  • OS: macOS (Darwin 25.3.0, arm64)

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗