OAuth login URL breaks when terminal is narrow (especially over SSH)

Resolved 💬 6 comments Opened Mar 15, 2026 by Gloucester22 Closed May 23, 2026

Bug

When running claude login in a narrow terminal (common when SSH'd into a remote server), the OAuth URL wraps with hard line breaks. When the user copies the URL — either manually or via the c to copy prompt — the line breaks are included, splitting parameter names like redirect_uri and code_challenge across lines. The OAuth server then rejects the request with errors like:

  • Missing redirect_uri parameter
  • Missing code_challenge parameter

Repro

  1. SSH into a remote server with a typical ~80-column terminal
  2. Run claude login
  3. The generated URL is ~500+ characters and wraps across 3-4 lines
  4. Copy the URL (manually or via c prompt) and paste into browser
  5. OAuth fails because parameter names are broken by newlines

Why c to copy doesn't help over SSH

Over SSH there's no access to the local machine's clipboard, so the c shortcut either doesn't work or copies with the line breaks intact.

Suggested fixes

  • Write the URL to a temp file and tell the user to cat or open it (this is what we did as a workaround and it worked immediately)
  • Detect narrow terminals and automatically write the URL to a file
  • Use a short-lived redirect/URL shortener for the auth URL
  • At minimum, warn the user if the terminal width is too narrow for the URL

Environment

  • Claude Code v2.1.76
  • SSH session to Ubuntu server
  • Terminal width ~80-120 columns
  • macOS client -> Ubuntu remote

🤖 Generated with Claude Code

View original on GitHub ↗

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