FIX Jul 10, 2026 13 min read

Claude Code Login Not Working: Fix Browser Handoff, CLI Auth, and Local Environment Issues

TL;DR First prove the same Anthropic account can sign in through a normal browser profile. Then run Claude Code login from a local interactive terminal and watch whether the browser…

by Bugi 13 min
TL;DR

  • First prove the same Anthropic account can sign in through a normal browser profile.
  • Then run Claude Code login from a local interactive terminal and watch whether the browser callback returns to the CLI.
  • If browser login works but the terminal stays stuck, isolate browser profile, local vs remote shell, network policy, and writable home directory before deleting credentials or reinstalling.

Overview

Claude Code login failures usually show up at the handoff point: the terminal starts authentication, the browser opens, and then something between the browser session and the CLI does not line up. The cause is often ordinary rather than dramatic: the wrong browser profile, a stale web session, a remote shell waiting for a callback on another machine, or a network tool interfering with redirects.

Treat the first pass like a small reproduction test. Use one account, one browser profile, one local terminal, and one network. If that path works, reintroduce WSL, SSH, containers, VPNs, and IDE terminals one at a time. If it does not work, the exact place where it breaks tells you what to fix next.

Anthropic documents Claude Code setup and authentication entry points in Anthropic’s Claude Code setup documentation, with broader usage details in Anthropic’s Claude Code overview. This guide stays focused on troubleshooting the login path; it does not make claims about your plan, pricing, eligibility, current outages, or rollout status.

Quick fixes
  • Sign out in the browser, sign back into the intended Anthropic account, then retry Claude Code from a local terminal.
  • Use a fresh browser profile with extensions disabled if the browser opens but the terminal never receives the result.
  • Run the first login on the host machine, not inside WSL, SSH, Docker, CI, or a restricted remote IDE shell.
  • Temporarily compare a different trusted network if VPN, proxy, DNS filtering, or SSL inspection may be touching auth traffic.
  • If the wrong account opens, copy the login URL from the terminal into the browser profile that is already signed into the correct account.

Symptoms

A broken login can look different depending on where the chain fails. The browser may open and complete sign-in, while the terminal keeps waiting. The CLI may appear to authenticate, then fail again on the next command. You might also see repeated account prompts in the browser, or discover that macOS, Windows, or your desktop environment opened a default browser profile tied to a different Anthropic account.

Do not begin by assuming an Anthropic outage or a bad install. Without a current official status signal, handle it as a local auth-path problem first: browser session, redirect/callback, shell environment, network policy, or local storage. If you need service availability information, use Anthropic’s official status page rather than screenshots or social posts.

Use the Exact Login Commands

Start with the supported interactive path from a normal local terminal. The login action is performed from inside Claude Code with the slash command.

# Start Claude Code from a local interactive terminal
claude

# At the Claude Code prompt, start or switch authentication
/login

# If you need to sign out first, use this inside Claude Code, then run /login again
/logout
/login

If your shell cannot start Claude Code at all, confirm that the executable is on your PATH before treating it as an authentication problem.

command -v claude
claude --help

If claude opens but /login does not complete, keep the terminal visible while the browser flow runs. The most useful symptom is not just “login failed”; it is whether the browser opened, whether the account was correct, whether the browser returned to the CLI, and whether the next Claude Code command stayed authenticated.

Warning
Do not rotate credentials, delete config directories, or change organization settings as a first step. First confirm whether the browser login flow, terminal callback, or local credential write is the failing layer.

Decision Tree: Find the Failing Layer

Use this order instead of changing several things at once.

1. Does Anthropic login work in the browser?

If the browser cannot sign into the intended Anthropic account, pause CLI debugging. Finish the account, SSO, or browser sign-in flow first. Check the official status page only if the browser itself fails in a way that looks service-wide.

If the browser works normally, continue to the CLI handoff.

2. Does the CLI callback return after browser login?

Run claude, then /login, from a local terminal. If the browser opens, authenticates, and the terminal proceeds, test one ordinary Claude Code command before changing environments.

If the browser completes but the terminal keeps waiting, suspect the callback path. Retry with a clean browser profile, extensions disabled, and the correct account already signed in. If the terminal printed a login URL, paste that URL into the intended browser profile instead of letting the operating system choose the wrong default profile.

3. Are you local, or inside WSL, SSH, a container, or a remote IDE?

If login fails inside WSL, SSH, Docker, a dev container, CI, or a cloud workstation, retry from the host machine’s normal terminal first. A browser on your laptop and a CLI process inside another environment may not share the same callback route or file system. After host login works, return to the remote or containerized environment and test again.

If local terminal login also fails, continue to storage and network isolation.

4. Does changing network change the behavior?

If login works on a personal hotspot or another trusted network but fails on corporate Wi-Fi or VPN, treat the network path as the likely cause. Proxies, SSL inspection, DNS filtering, endpoint protection, and firewall policy can interfere with authentication pages or redirects.

If changing networks does not change the symptom, inspect browser profile state, local permissions, and the exact CLI output.

Start With Account and Access Checks

Open Claude or the Anthropic console in the browser profile you actually want Claude Code to use. Sign out, sign back in, and confirm that the visible account is the expected one. If your organization uses SSO, complete that browser flow before returning to the terminal.

Then retry from a local terminal with claude followed by /login. If the browser cannot authenticate independently, Claude Code is not the root cause. If the browser authenticates but the CLI does not move forward, the problem is the handoff between browser and terminal.

01

Check browser account access

Prove the intended Anthropic account works in a normal browser profile before debugging the CLI.

Try a Clean Browser Session

Browser state is the highest-yield safe fix. Create a temporary browser profile, disable extensions, sign into the intended Anthropic account, and run /login again. Privacy extensions, script blockers, cookie restrictions, and aggressive redirect protection can all break a login flow without producing a clear terminal error.

Profile selection matters too. Safari, Chrome, Edge, and Firefox do not always open the profile you expect from a command-line login link. If the operating system opens the wrong account, copy the login URL from the terminal and paste it into the clean profile that is already signed into the right account.

Tip
For the first successful login, use the simplest browser state possible: one profile, no extensions, correct account already signed in.
02

Retry with a clean browser profile

Disable extensions and force the login URL into the browser profile tied to the intended account.

Confirm the Terminal Login Flow

Use a standard interactive terminal on the same machine that owns the browser session. Avoid CI jobs, non-interactive shells, restricted containers, remote SSH terminals, and IDE terminals for the first login attempt. Those environments are useful after authentication works, but they add extra moving parts while you are still locating the fault.

# Run from the host machine first
claude

# Then, inside Claude Code
/login

# Confirm which machine and user are running the CLI
pwd
whoami
printf '%s\n' "$HOME"

If the host terminal succeeds and the remote/dev-container terminal fails, you have narrowed the issue to environment boundary, path, callback, or credential visibility. Do not reinstall yet; reproduce the same account and network from the simpler environment first.

03

Use the host terminal first

Complete initial login outside WSL, SSH, Docker, CI, and remote IDE shells whenever possible.

Check Local Permissions and Credential Storage

After browser authentication succeeds, Claude Code still needs usable local state for later commands. Anthropic’s setup documentation is the primary reference for the supported authentication path; locally, your troubleshooting job is to confirm that the CLI is running as the expected operating-system user and can write under that user’s home directory.

# Confirm active user and home directory
whoami
printf '%s\n' "$HOME"

# Confirm the home directory is writable
test -w "$HOME" && echo "home is writable" || echo "home is not writable"

# Avoid logging in as a different OS user unless official docs instruct it
sudo claude

If you authenticate with sudo, a root shell, a container user, or a different remote user, the normal user may still appear logged out afterward. Fix the user/environment mismatch before deleting local configuration.

Danger
Do not paste authentication URLs, tokens, session cookies, or CLI config contents into public issue trackers. Redact secrets before sharing logs.
04

Verify writable local state

Use the same OS user for login and day-to-day Claude Code commands, and confirm that the home directory is writable.

Run Platform-Specific Checks

On macOS, check which default browser and profile opens when the CLI launches a URL. If the wrong profile keeps winning, paste the login URL into the intended profile manually for the first login.

On Windows, separate native Windows terminals from WSL terminals. If claude runs in WSL but the browser opens on Windows, test the Windows host terminal first. Then return to WSL only after the basic account and browser path is known to work.

On Linux desktops, confirm that browser URL handlers work from the terminal. A headless server, minimal desktop session, SSH connection, or container may not have the same browser integration as a full local desktop.

In enterprise environments, test with policy in mind. VPNs, SSL inspection, endpoint security, DNS filtering, and outbound firewall rules can alter authentication traffic. If policy allows, compare one trusted alternate network. A behavior change across networks is stronger evidence than reinstalling the CLI.

Symptom-Specific Fixes

If the browser opens but the terminal waits forever, keep the terminal open, copy the login URL into a clean browser profile, and retry from the host terminal. If that works, the issue was browser profile routing, extension interference, or local/remote callback mismatch.

If Claude Code logs into the wrong account, sign out in that browser profile, sign into the intended account, then run /logout and /login inside Claude Code. If the OS keeps choosing the wrong profile, paste the login URL manually into the correct profile.

If login works once and fails on the next command, check the OS user and home directory. A read-only home, root login, container user, or different remote account can make the stored auth state unavailable to your normal shell.

If login works on another network, capture the difference: VPN on/off, proxy on/off, corporate Wi-Fi vs hotspot, DNS filtering, and SSL inspection. Give that reproduction to your network or security team rather than repeatedly clearing browser state.

If the CLI prints an exact error, preserve the exact wording for support, but redact secrets. Error text changes across versions and environments, so do not rewrite it into a paraphrase. A useful note says: command run, environment, browser used, whether callback returned, network used, and the exact visible error with tokens removed.

Opinionated Fix Order

Use this sequence: browser account check, clean browser profile, local host terminal, /logout then /login if the wrong account is stuck, writable home directory, alternate trusted network, then escalation. Reinstalling belongs later because it does not fix stale browser sessions, wrong default profiles, remote callback mismatches, SSO state, or a non-writable home directory.

Takeaway

Treat Claude Code login as a browser-to-terminal handoff first, then isolate environment, storage, and network one layer at a time.

If It Still Fails

Prepare a clean escalation report. Include the command you ran, whether it was local/WSL/SSH/container, operating system, browser and profile used, account type if relevant, network path, whether browser login works, whether the CLI callback returned, and the exact visible error text after redaction.

Do not include authorization URLs, tokens, cookies, private config files, account identifiers, private paths, or project data. Retry once from a clean browser profile and once from a different trusted network if available. Then use Anthropic’s official support or community route with the reproduction details.

FAQ

Why is Claude Code login not working after the browser opens?

The browser may authenticate the account, but the terminal still needs the login result. A blocked redirect, wrong browser profile, remote shell, or local callback mismatch can break that handoff.

What command should I use to log into Claude Code?

Start Claude Code with claude, then run /login inside the Claude Code prompt. If the wrong account is stuck, use /logout and then /login again.

Should I reinstall Claude Code to fix login?

Not first. Reinstall only after checking browser account access, a clean browser profile, local host terminal login, writable home directory, and network/proxy behavior.

Can a VPN or corporate proxy break Claude Code login?

Yes. VPNs, SSL inspection, DNS filtering, endpoint protection, and proxies can interfere with authentication pages or redirects. If policy allows, compare behavior on another trusted network.

Why does Claude Code log in as the wrong account?

The operating system may open the default browser profile instead of the profile you intended. Sign into the correct account in a clean profile, then paste the login URL there or temporarily change the default browser/profile.

Is this always an Anthropic outage?

No. Without real-time evidence from Anthropic’s official status page, treat it as a local account, browser, terminal, or network issue first.

Is it safe to share Claude Code login logs?

Only after redaction. Remove authorization URLs, tokens, cookies, account identifiers, private paths, project data, and any CLI config contents before posting logs publicly or sending them to support.

Why is Claude Code login not working after the browser opens?
The browser may authenticate the account, but the terminal still needs the login result. A blocked redirect, wrong browser profile, remote shell, or local callback mismatch can break that handoff.
What command should I use to log into Claude Code?
Start Claude Code with `claude`, then run `/login` inside the Claude Code prompt. If the wrong account is stuck, use `/logout` and then `/login` again.
Should I reinstall Claude Code to fix login?
Not first. Reinstall only after checking browser account access, a clean browser profile, local host terminal login, writable home directory, and network/proxy behavior.
Can a VPN or corporate proxy break Claude Code login?
Yes. VPNs, SSL inspection, DNS filtering, endpoint protection, and proxies can interfere with authentication pages or redirects. If policy allows, compare behavior on another trusted network.
Why does Claude Code log in as the wrong account?
The operating system may open the default browser profile instead of the profile you intended. Sign into the correct account in a clean profile, then paste the login URL there or temporarily change the default browser/profile.
Is this always an Anthropic outage?
No. Without real-time evidence from Anthropic’s official status page, treat it as a local account, browser, terminal, or network issue first.
Is it safe to share Claude Code login logs?
Only after redaction. Remove authorization URLs, tokens, cookies, account identifiers, private paths, project data, and any CLI config contents before posting logs publicly or sending them to support.