Fix Claude Code Login — Cannot Paste Auth Code

Written by Michael Lip · Solo founder of Zovo · $400K+ on Upwork · 100% JSS Join 50+ builders · More at zovo.one

TL;DR: Claude Code’s login prompt sometimes does not accept pasted text due to terminal paste bracketing. Disable paste bracketing, type the code manually, or use the ANTHROPIC_API_KEY environment variable instead.

The Problem

When running claude /login, you complete the browser authorization flow and receive a code to paste back into the CLI. But when you try to paste it:

Paste code here if prompted >

Nothing happens. The pasted text does not appear, and pressing Enter gives an empty input error. This is a known regression affecting v2.1.105+ on Linux, WSL, and some macOS terminal configurations.

Why This Happens

Modern terminals use “paste bracketing” — they wrap pasted text in escape sequences (\e[200~....\e[201~) to distinguish it from typed input. Claude Code’s TUI input handler does not always process these escape sequences correctly, causing the pasted text to be silently discarded.

This is tracked as a known bug in the Claude Code repository (issues #47648, #47670, #47656).

The Fix

Step 1 — Try Disabling Paste Bracketing

Before running claude /login, disable paste bracketing in your terminal:

# Disable paste bracketing for the current session
printf '\e[?2004l'

# Then run login
claude /login

Step 2 — Use Manual Typing (Short Codes)

If the auth code is short enough (usually 6-8 characters), type it manually character by character rather than pasting.

Step 3 — Use API Key Authentication Instead

The most reliable workaround is to bypass the browser OAuth flow entirely:

# Get your API key from https://console.anthropic.com/
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"

# Add to your shell profile for persistence
echo 'export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"' >> ~/.zshrc
source ~/.zshrc

# Verify Claude Code can authenticate
claude --version

Step 4 — WSL-Specific Fix

If you are using WSL (Windows Subsystem for Linux), there is an additional issue where the WSL terminal does not pass clipboard contents correctly:

# Option 1: Use powershell.exe to get clipboard
CODE=$(powershell.exe -command "Get-Clipboard" | tr -d '\r')
echo "$CODE" | claude /login

# Option 2: Use xclip if X11 is configured
sudo apt install xclip
xclip -o -selection clipboard | claude /login

Step 5 — Verify It Works

# Check authentication status
claude auth status

Expected output:

Authenticated as: [email protected]
Subscription: Pro/Max
API: Anthropic

Common Variations

Scenario Cause Quick Fix
Paste works in other apps, not Claude Paste bracketing in TUI printf '\e[?2004l' before login
WSL2 paste broken WSL clipboard isolation Use powershell.exe Get-Clipboard pipe
Dev Container paste broken Container terminal limitations Use ANTHROPIC_API_KEY env var
SSH session paste broken Remote terminal escape handling Use API key auth or tmux paste
Works on v2.1.104, broken on v2.1.105 Regression in TUI input Downgrade or use API key auth

Prevention


Last verified: 2026-04-14. Found an issue? Open a GitHub issue.