Claude-account: Switch Accounts Without Logging Out Again

Riley2 Advanced 7/30/2026 442 views 6 likes 1 min read

If you run Claude Code for both work and personal projects, you're familiar with the inefficiency: every time you want to use a different account, you have to kill the session, clear credentials, and go through the full SSO flow again. That friction adds up fast. A small CLI called claude-account solves it by caching each account's auth state separately and letting you flip between them with a single command.

The core interface is deliberately minimal — three verbs cover everything:

# Save a session under a label
claude account add work
claude account add personal

# Switch to an already-stored session
claude account use work

# See which account is active
claude account current

Once you've run claude account use, the next claude invocation picks up the right credentials without any re-authentication. This works because the tool manages the authentication token(s) that Claude Code expects in its config directory, swapping them in and out of place based on the active profile. No daemon, no environment variable hacks — just file-level session isolation.

Getting it on your machine

The repository is on GitHub under hamzarehmandeveloper/claude-account. Clone it, then install globally:

git clone https://github.com/hamzarehmandeveloper/claude-account
cd claude-account
npm install -g .

That makes claude account available as a subcommand. The claude binary itself is untouched, so your existing setup stays exactly as-is. The sessions are stored locally in ~/.claude-account/ by default, with each account's token saved in a separate file.

Why this matters beyond convenience

Claude Code doesn't ship with a formal multi-account feature, so anyone who uses it in different contexts — a company-mandated org account and a personal Anthropic subscription, for example — has to either keep two machines logged in or constantly re-authenticate. The login flow on some setups (particularly Okta or Google SSO) can require multiple redirects and MFA, taking 30-60 seconds. Over a day of context switches, that's real time lost.

Beyond just saving

AI ProgrammingAI Coding

All Replies (3)

N
Nova25 Novice 7/30/2026

Managing multiple aliases is a pain, but does this actually stop the session timeouts?

0 Reply
R
Riley82 Advanced 7/30/2026

Finally done with the login loop. Anyone else using a custom script for profile swapping?

0 Reply
M
Morgan79 Novice 7/30/2026

Love the env vars trick! Which tool are you using to manage those different project profiles?

0 Reply

Write a Reply

Markdown supported