[BUG] OAuth authentification fails on WSL2
Open 💬 4 comments Opened Jun 1, 2026 by MacaItkin
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?
OAuth authentication fails repeatedly in Claude Code Terminal on WSL2, despite successful network connectivity. When running claude auth login, and pasting the link into the browser, the authorization code works and opens claude chat, but the token does not save to the command line. If I use the token in the command line as the code, it gives a OAuth error: invalid code. All authentication methods fail:
-standard claude login in CLI
-claude auth login in CLI
-claude set up token
The issue persist after reinstallation, trying multiple paste methods
What Should Happen?
- User runs claude auth login
- Browser opens Claude's authentication URL
- User logs into claude.ai and receives authorization code
- browser redirects the callback URL
- Claude code CLI captures the callback and exchanges the code for an access token
- token saves locally and authentication completes
Error Messages/Logs
OAuth error: Invalid code. Please make sure the full code was copied
Steps to Reproduce
- install claude
- in CLI, run claude auth login
- paste URL
- login in into claude
- copy authorization code
- return to WSL terminal and paste code
- OAuth error occurs
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.159
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗