Skip to content

[bug] OAuth account switching fails on macOS — Claude re-prompts for login, Codex reports a revoked refresh token (v0.3.7) #41

Description

@danielraffel

Preconditions

  • I read existing issues and this does not appear to be a duplicate.
  • I can reproduce this on the latest released version.
  • I understand logs and credentials in this issue must be redacted.

Issue Type

Runtime failure (command exits non-zero)

Summary

I cannot get this to work for Claude or Codex.

Steps to Reproduce

Environment
- aisw 0.3.7
- macOS 26.5.2 (Apple Silicon) 
- Claude Code 2.1.209 (OAuth)
- Codex CLI 0.144.1 (OAuth)
- Both tools authenticated via OAuth (subscription accounts), not API keys

What I did (exact steps)
1. aisw init — imported the currently-live credentials as profile primary for both Claude Code and Codex CLI (account-one@example.com). Then logged out of each Claude/Codex CLI.
2. Logged into Claude Code as the second account (account-two@example.com) via the normal login flow, then captured it: aisw add claude second --from-live.
3. Did the same for Codex: logged in as account-two@example.com, then aisw add codex second --from-live.
4. aisw list confirms both profiles exist for both tools; aisw use <tool> <profile> reports success switching between them.

Expected Behavior

What I expected
aisw use claude second / aisw use codex second (and back) switches the active account with no re-login, so I can hop between two accounts on the same machine.

Actual Behavior

What actually happened

  • Claude Code: after switching profiles, Claude does not use the switched account — it drops me into the normal login flow and asks me to sign in again, as if no credentials are present. aisw status shows Claude Backend: file, but Claude on macOS stores its auth in the Keychain — is the file-backed switch not writing where Claude actually reads? (aisw status also flags the "permissions too broad.")
  • Codex CLI: after switching, Codex fails with:
    ▎ Your access token could not be refreshed because your refresh tog out and sign in again.
    ▎ This looks like the snapshotted OAuth refresh token was rotated/revoked by the provider between capture and restore.

Command Output

Questions
- Is switching between two OAuth subscription accounts possible?
- For Claude on macOS, can profiles be imported from Keychain I get a lot of popups?
- For Codex OAuth, is there a way to avoid the refresh-token-revoing a saved token snapshot, given OAuth refresh tokens rotate onuse?
- Am I doing something wrong? It seems like this does not work.

Diagnostic Output

✓ tool/claude                      /var/folders/8_/REDACTED/T//cmux-cli-shims/REDACTED/claude found (2.1.211 (Claude Code))
  ✓ tool/codex                       /Users/REDACTED/.local/bin/codex found (codex-cli 0.144.4)
  ✗ tool/gemini                      gemini not found on PATH — install it or add it to PATH
  ✓ config/json                      valid (schema v2)
  ✓ keyring                          OS keyring is accessible
  ✓ shell/hook                       hook present in /Users/REDACTED/.zshrc
  ✓ permissions/claude/redactedA     0600 ok
  ✗ permissions/claude/redactedA        credentials file missing: /Users/REDACTED/.aisw/profiles/claude/REDACTED/.credentials.json
  ✓ permissions/codex/redactedB         0600 ok
  ✓ permissions/codex/redactedB           0600 ok
  ✗ permissions/gemini/redacted        credentials file missing: /Users/redacted/.aisw/profiles/gemini/REDACTED/oauth_credentials.json

One or more checks failed.

aisw Version

0.3.7

OS and Version

macOS 26.5.2

Shell

zsh 5.9 (arm64-apple-darwin25.0)

Install Method

Homebrew

Affected Tool Integrations

  • Claude
  • Codex
  • Gemini
  • Not tool-specific

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclaude codeclaude code related issuescodexcodex related issues

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions