[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?

  1. User runs claude auth login
  2. Browser opens Claude's authentication URL
  3. User logs into claude.ai and receives authorization code
  4. browser redirects the callback URL
  5. Claude code CLI captures the callback and exchanges the code for an access token
  6. token saves locally and authentication completes

Error Messages/Logs

OAuth error: Invalid code. Please make sure the full code was copied

Steps to Reproduce

  1. install claude
  2. in CLI, run claude auth login
  3. paste URL
  4. login in into claude
  5. copy authorization code
  6. return to WSL terminal and paste code
  7. 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_

View original on GitHub ↗

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