Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Why my saved Claude Code logins kept dying, and the switcher I built around it

Описание и применение

Инструмент claude-switch позволяет переключаться между несколькими аккаунтами Claude Code, автоматически управляя токенами и предотвращая их истечение.

Задача

Claude Code logins become invalid after a single use of the refresh token, causing sessions to expire when switching accounts.

Результат

The tool keeps the most recent login, respects OAuth single-use tokens, uses locks to avoid race conditions, and warns when a login is dead, enabling seamless switching between multiple Claude accounts.

Рабочий процесс

  • 1. Install claude-switch via pipx. 2. Save the current account with claude-switch save <name>. 3. Add a new account with claude-switch add <name> and authenticate via browser. 4. Save the new account. 5. List accounts with claude-switch list. 6. Switch accounts with claude-switch use <name> or claude-switch auto. 7. Continue conversation in an open session by exiting and restarting Claude with claude -c.

Доказательства

Claude Code signs in with OAuth. It holds a short-lived access token, about 8 hours, and a refresh token. When the access token runs out, Claude Code trades the refresh token for a new pair and writes both back.

Источник

The server accepts each refresh token once. After a renewal, the old one is dead.

Источник

claude-switch keeps one Claude Code profile and swaps only the login.

Источник

It takes Claude Code's own locks during the swap, in the same order Claude Code takes them, so no running session renews or rewrites the login halfway through.

Источник

It refuses to file one account's login under another name. It compares logins by a SHA-256 hash of the refresh token and by the email Claude Code records.

Источник

  • Дата записи: 2026-11-02T21:14:03.129Z