[BUG] claude auth login WSL2 stdin does not accept OAuth code — cannot authenticate to Claude Max

Resolved 💬 13 comments Opened Apr 6, 2026 by x10roissy Closed Apr 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Environment

  • OS: Windows 11 + WSL2 Ubuntu 22.04
  • Claude Code Version: 2.1.92
  • Account: Claude Max subscription (active)

Bug
claude auth login in WSL2 opens the browser correctly and generates the OAuth URL, but the terminal does not accept any keyboard input to paste the OAuth code returned by the browser. The terminal appears frozen waiting for input that never registers.

As a result, Claude Code displays "Sonnet 4.6 · API Usage Billing" instead of "Claude Max" and shows "Not logged in · Run /login" permanently.

Steps to reproduce

  1. WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
  2. Run: claude auth login
  3. Browser opens, OAuth completes, code is generated
  4. Terminal does not accept the code — no keyboard input works (Ctrl+V, right-click, typing)

What was tried

  • Removed ANTHROPIC_API_KEY from .bashrc ✅
  • Deleted ~/.claude/.credentials.json ✅
  • CLAUDE_CODE_DISABLE_HOOKS=1 claude auth login — same result ✅
  • wsl -d Ubuntu-22.04 -- bash -c "claude auth login" from PowerShell — same result ✅
  • wsl -d Ubuntu-22.04 -e bash -i -c "claude auth login" — same result ✅
  • env -i HOME=$HOME PATH=... claude auth login — same result ✅

Workaround
Install Claude Code on Windows natively, run claude auth login from PowerShell, then copy %USERPROFILE%\.claude\.credentials.json to \\wsl$\Ubuntu-22.04\home\user\.claude\.credentials.json. This works but requires manual intervention every time the token expires (~1 hour).

Expected behavior
claude auth login should accept the OAuth code in WSL2 terminal.

Request

  • Fix WSL2 stdin handling for OAuth code input
  • Or provide a claude auth login --code <code> flag to pass the code directly

What Should Happen?

Environment

  • OS: Windows 11 + WSL2 Ubuntu 22.04
  • Claude Code Version: 2.1.92
  • Account: Claude Max subscription (active)

Bug
claude auth login in WSL2 opens the browser correctly and generates the OAuth URL, but the terminal does not accept any keyboard input to paste the OAuth code returned by the browser. The terminal appears frozen waiting for input that never registers.

As a result, Claude Code displays "Sonnet 4.6 · API Usage Billing" instead of "Claude Max" and shows "Not logged in · Run /login" permanently.

Steps to reproduce

  1. WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
  2. Run: claude auth login
  3. Browser opens, OAuth completes, code is generated
  4. Terminal does not accept the code — no keyboard input works (Ctrl+V, right-click, typing)

What was tried

  • Removed ANTHROPIC_API_KEY from .bashrc ✅
  • Deleted ~/.claude/.credentials.json ✅
  • CLAUDE_CODE_DISABLE_HOOKS=1 claude auth login — same result ✅
  • wsl -d Ubuntu-22.04 -- bash -c "claude auth login" from PowerShell — same result ✅
  • wsl -d Ubuntu-22.04 -e bash -i -c "claude auth login" — same result ✅
  • env -i HOME=$HOME PATH=... claude auth login — same result ✅

Workaround
Install Claude Code on Windows natively, run claude auth login from PowerShell, then copy %USERPROFILE%\.claude\.credentials.json to \\wsl$\Ubuntu-22.04\home\user\.claude\.credentials.json. This works but requires manual intervention every time the token expires (~1 hour).

Expected behavior
claude auth login should accept the OAuth code in WSL2 terminal.

Request

  • Fix WSL2 stdin handling for OAuth code input
  • Or provide a claude auth login --code <code> flag to pass the code directly

Error Messages/Logs

**Environment**
- OS: Windows 11 + WSL2 Ubuntu 22.04
- Claude Code Version: 2.1.92
- Account: Claude Max subscription (active)

**Bug**
`claude auth login` in WSL2 opens the browser correctly and generates the OAuth URL, but the terminal does not accept any keyboard input to paste the OAuth code returned by the browser. The terminal appears frozen waiting for input that never registers.

As a result, Claude Code displays "Sonnet 4.6 · API Usage Billing" instead of "Claude Max" and shows "Not logged in · Run /login" permanently.

**Steps to reproduce**
1. WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
2. Run: claude auth login
3. Browser opens, OAuth completes, code is generated
4. Terminal does not accept the code — no keyboard input works (Ctrl+V, right-click, typing)

**What was tried**
- Removed ANTHROPIC_API_KEY from .bashrc ✅
- Deleted ~/.claude/.credentials.json ✅
- CLAUDE_CODE_DISABLE_HOOKS=1 claude auth login — same result ✅
- wsl -d Ubuntu-22.04 -- bash -c "claude auth login" from PowerShell — same result ✅
- wsl -d Ubuntu-22.04 -e bash -i -c "claude auth login" — same result ✅
- env -i HOME=$HOME PATH=... claude auth login — same result ✅

**Workaround**
Install Claude Code on Windows natively, run `claude auth login` from PowerShell, then copy `%USERPROFILE%\.claude\.credentials.json` to `\\wsl$\Ubuntu-22.04\home\user\.claude\.credentials.json`. This works but requires manual intervention every time the token expires (~1 hour).

**Expected behavior**
`claude auth login` should accept the OAuth code in WSL2 terminal.

**Request**
- Fix WSL2 stdin handling for OAuth code input
- Or provide a `claude auth login --code <code>` flag to pass the code directly

Steps to Reproduce

Environment

  • OS: Windows 11 + WSL2 Ubuntu 22.04
  • Claude Code Version: 2.1.92
  • Account: Claude Max subscription (active)

Bug
claude auth login in WSL2 opens the browser correctly and generates the OAuth URL, but the terminal does not accept any keyboard input to paste the OAuth code returned by the browser. The terminal appears frozen waiting for input that never registers.

As a result, Claude Code displays "Sonnet 4.6 · API Usage Billing" instead of "Claude Max" and shows "Not logged in · Run /login" permanently.

Steps to reproduce

  1. WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
  2. Run: claude auth login
  3. Browser opens, OAuth completes, code is generated
  4. Terminal does not accept the code — no keyboard input works (Ctrl+V, right-click, typing)

What was tried

  • Removed ANTHROPIC_API_KEY from .bashrc ✅
  • Deleted ~/.claude/.credentials.json ✅
  • CLAUDE_CODE_DISABLE_HOOKS=1 claude auth login — same result ✅
  • wsl -d Ubuntu-22.04 -- bash -c "claude auth login" from PowerShell — same result ✅
  • wsl -d Ubuntu-22.04 -e bash -i -c "claude auth login" — same result ✅
  • env -i HOME=$HOME PATH=... claude auth login — same result ✅

Workaround
Install Claude Code on Windows natively, run claude auth login from PowerShell, then copy %USERPROFILE%\.claude\.credentials.json to \\wsl$\Ubuntu-22.04\home\user\.claude\.credentials.json. This works but requires manual intervention every time the token expires (~1 hour).

Expected behavior
claude auth login should accept the OAuth code in WSL2 terminal.

Request

  • Fix WSL2 stdin handling for OAuth code input
  • Or provide a claude auth login --code <code> flag to pass the code directly

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

5 days ago

Claude Code Version

Claude Code Version: 2.1.92

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Environment

  • OS: Windows 11 + WSL2 Ubuntu 22.04
  • Claude Code Version: 2.1.92
  • Account: Claude Max subscription (active)

Bug
claude auth login in WSL2 opens the browser correctly and generates the OAuth URL, but the terminal does not accept any keyboard input to paste the OAuth code returned by the browser. The terminal appears frozen waiting for input that never registers.

As a result, Claude Code displays "Sonnet 4.6 · API Usage Billing" instead of "Claude Max" and shows "Not logged in · Run /login" permanently.

Steps to reproduce

  1. WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
  2. Run: claude auth login
  3. Browser opens, OAuth completes, code is generated
  4. Terminal does not accept the code — no keyboard input works (Ctrl+V, right-click, typing)

What was tried

  • Removed ANTHROPIC_API_KEY from .bashrc ✅
  • Deleted ~/.claude/.credentials.json ✅
  • CLAUDE_CODE_DISABLE_HOOKS=1 claude auth login — same result ✅
  • wsl -d Ubuntu-22.04 -- bash -c "claude auth login" from PowerShell — same result ✅
  • wsl -d Ubuntu-22.04 -e bash -i -c "claude auth login" — same result ✅
  • env -i HOME=$HOME PATH=... claude auth login — same result ✅

Workaround
Install Claude Code on Windows natively, run claude auth login from PowerShell, then copy %USERPROFILE%\.claude\.credentials.json to \\wsl$\Ubuntu-22.04\home\user\.claude\.credentials.json. This works but requires manual intervention every time the token expires (~1 hour).

Expected behavior
claude auth login should accept the OAuth code in WSL2 terminal.

Request

  • Fix WSL2 stdin handling for OAuth code input
  • Or provide a claude auth login --code <code> flag to pass the code directly

View original on GitHub ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗