Why the sign-in opens in the wrong profile
Claude Code and the Codex CLI sign in through a browser window. Your default browser gets the sign-in link, and it opens the link in the profile whose window you used last.
If that profile is signed in to your personal Claude or ChatGPT account, you approve the tool with the wrong account. With a work plan and a personal plan, the terminal then bills or limits the wrong one.
Claude Code: copy the login link
Claude Code opens the sign-in page when you first run claude, and when you type /login. To open it in another profile:
- Close the tab that opened in the wrong profile.
- In the terminal, press c to copy the login link.
- Paste it into a window of the right profile, and sign in.
- If the page shows a code, paste it at the Paste code here if prompted prompt.
The terminal shows Login successful when it's done.
Codex: sign in with a device code
The device code sign-in doesn't open a browser at all. You open the link yourself, in any profile:
codex login --device-auth
Open the link it prints in the right profile, sign in, and enter the one-time code. OpenAI calls this beta. Turn it on first in your ChatGPT security settings, or, for a workspace, your admin turns it on in the workspace permissions.
Two Claude accounts on one computer
If you use a work and a personal Claude account, give each its own configuration folder with CLAUDE_CONFIG_DIR. Each folder keeps its own sign-in:
CLAUDE_CONFIG_DIR=~/.claude-work claude
Sign in once in each, from the right browser profile. Put the line in a shell alias, such as claude-work, to keep it.
Every tool: sign-in links where you're signed in
Copying links works, but you do it every time a token runs out. Profile Porter does it for you on Mac and Windows. Make it your default browser. When a tool's link starts a sign-in, such as the login page of Claude Code or Codex, it opens in the profile that is signed in to that provider.
- If no profile is signed in, it asks rather than guess, and remembers your pick for sign-ins from that app.
- If you were on the site in the last 15 minutes, the link goes to that profile.
- No setup per tool: it looks at the link itself, so
gh,aws,gcloudand other tools that open a sign-in page work the same way.
Get Profile Porter for €12, once.
Everything included, no account, and a full refund within 14 days if it isn't for you. macOS 14 or later; on Windows 10 and 11, get it from the Microsoft Store.