Claude-account: Switch Accounts Without Logging Out Again

Riley2 Advanced 1h ago 407 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 1h ago
Been using this, works great but you need an alias per account. A bit annoying but solid.
0 Reply
R
Riley82 Advanced 1h ago
The constant logging out was tedious. I now have a script that swaps profiles for me.
0 Reply
M
Morgan79 Novice 1h ago
I use separate env vars per project, makes switching accounts seamless.
0 Reply

Write a Reply

Markdown supported