[BUG] claude auth login WSL2 stdin does not accept OAuth code — cannot authenticate to Claude Max
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)
Bugclaude 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
- WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
- Run: claude auth login
- Browser opens, OAuth completes, code is generated
- 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 behaviorclaude 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)
Bugclaude 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
- WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
- Run: claude auth login
- Browser opens, OAuth completes, code is generated
- 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 behaviorclaude 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)
Bugclaude 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
- WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
- Run: claude auth login
- Browser opens, OAuth completes, code is generated
- 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 behaviorclaude 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)
Bugclaude 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
- WSL2 Ubuntu 22.04, no ANTHROPIC_API_KEY set
- Run: claude auth login
- Browser opens, OAuth completes, code is generated
- 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 behaviorclaude 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
13 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
@claude fix oauth on wsl asap!
also having this issue
also having this issue
I was not able to use the workaround to authenticate WSL.
I'm getting this issue in the android 16 debian terminal environment. It does not open the browser, so I click the link as instructed, get the auth code, but can't do anything with it
Edit:
claude /loginworked for mealso having this issue, but I have a work around that did not require installing on windows. After copying it to the clipboard you can quickly run this in powershell ISE and then click into the terminal window with claude. it will paste the contents of your clipboard into the window. I have seen what appeared to be a race condition where the login gets interrupted before its done typing, but it did work for me.
This worked for me:
https://github.com/anthropics/claude-code/issues/47669#issuecomment-4240338215
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).
Move the file instead, then login in again Windows-side (if desired), so that both Claude installs have their own refresh token. It has survived overnight, anyway.
I have the same issue, it was working yesterday...
FYI: this is a dupe of #41485, and the workaround is the
claude /loginflow which does present thePaste code here if prompted >prompt./loginpresents the field, and you can manually type, but it does not accept a paste, at least when WSL is accessed via Windows Terminal (relatively standard Windows 11 Enterprise + WSL) config.I used an app to copy+type and it authenticated successfully.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.