OAuth login fails with "Invalid code. Please make sure the full code was copied" despite entering the correct code

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 21, 2026

Environment:

  • OS: Windows 11 Pro (10.0.26200)
  • Shell: PowerShell / Git Bash (MSYS2)
  • Claude Code invoked via: /login

Steps to reproduce:

  1. Run /login in Claude Code
  2. Complete the browser-based auth flow and receive a verification code via email
  3. Copy the code from the email and paste it into the terminal prompt
  4. Submit the code

Expected behavior:
Login completes successfully.

Actual behavior:
Login fails with:

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

This happens even when the code is copied correctly and entered promptly. I've retried multiple times (/login interrupted and restarted each time) with the same result, including careful re-copying of the code to rule out stray whitespace/formatting issues.

Additional notes:

  • Tried both retyping manually and pasting via plain text to rule out smart-quote/whitespace corruption.
  • Multiple /login attempts in the same session were interrupted before this — unclear if a stale/previous auth session could be interfering.

View original on GitHub ↗