Codex Account Switcher
Switch between multiple local Codex logins from a VS Code sidebar.
Features
- Save unlimited Codex accounts.
- Identify accounts by email, falling back to account ID.
- Replace saved credentials when saving an already-known account.
- Switch accounts from the Codex Accounts sidebar.
- Save the current login before switching.
- Delete one account or all saved accounts with confirmation.
- Show only email/account ID in the UI; tokens are never displayed.
- Use VS Code SecretStorage for saved credentials.
Install locally
- Open VS Code.
- Press
Ctrl+Shift+P.
- Run Developer: Install Extension from Location....
- Select this folder.
- Run Developer: Reload Window.
Open the Codex Accounts icon in the Activity Bar.
Use
Save an account
- Sign in to the account using the normal Codex flow.
- Open Codex Accounts.
- Click Save current account.
- Confirm replacement if that account was already saved.
The extension reads the complete current Codex auth.json and stores it for that account. It does not merge individual token fields.
Switch accounts
- Open the account selector in the sidebar.
- Select a saved account.
- Click Apply.
- Confirm the switch.
- Restart the Codex Extension Host when prompted.
Before switching, the extension saves the current live auth.json to the current account profile. It then writes the selected account profile to the live Codex auth.json. Restarting the Extension Host makes the official Codex extension reread the selected credentials.
Delete accounts
Use the trash icon beside an account to delete one saved profile, or use Delete all saved accounts to remove every saved profile. Both actions require confirmation.
Deleting saved profiles does not delete or change the live Codex auth.json.
Security model
- Credentials are stored in VS Code SecretStorage, not in this repository.
- The extension has no telemetry or external service.
- The extension does not implement token refresh or send tokens to an API.
- Codex remains responsible for refreshing access and refresh tokens.
- The extension reads and writes the local Codex authentication file, normally
%USERPROFILE%\\.codex\\auth.json, or the path selected by CODEX_HOME.
Only install this extension from a source you trust. Anyone who can run code as your Windows user may be able to access local authentication data.
Package a VSIX
Install the VS Code extension packaging tool:
npm install -g @vscode/vsce
Then package the extension from this folder:
vsce package
VS Code can install the generated .vsix with Extensions: Install from VSIX....
Development
The extension is plain JavaScript and uses the VS Code Extension API. No runtime npm dependencies are required.
The repository is available at:
https://github.com/anuraj27/codex-two-account-switcher
License
MIT