Headless /login: OAuth URL can't be copied ('c' fails over SSH), blocking login on browserless hosts

Status Open
Maintainer reply None cached
Activity 1 comment · opened Aug 2, 2026

Environment

  • Claude Code v2.1.183, native install (~/.local/bin/claude)
  • Debian 11 (bullseye), headless Linux server (seedbox), accessed over SSH — no GUI or browser on the host
  • Terminal: plain SSH session

What happened

On a headless host with no browser, an interactive session that requires login shows the OAuth login screen with a URL to open in a browser. The intended escape hatch on a headless box is to press c to copy the URL (or select it) and open it on another machine.

In this case the copy action did nothing reachable over SSH, and the wrapped URL in the TUI could not be selected/copied — so there was no way to complete login on the headless host.

Expected

On a headless host there should be a reliable way to get the login URL out:

  • the c copy shortcut works, or
  • the full URL is printed plainly to stdout/stderr so it can be scrolled, selected, or piped

…so the browser step can be completed on a different machine.

Actual

  • c placed nothing on anything reachable over SSH
  • the wrapped URL in the alt-screen TUI couldn't be selected/copied
  • login was blocked entirely on the headless host

Repro

  1. SSH into a headless Linux host (no browser) with expired or missing credentials.
  2. Start claude (interactive).
  3. At the login screen, try to copy the OAuth URL — press c, or try to select the text.
  4. Observe that the URL can't be obtained, so login cannot be completed.

Workaround used

Bypassed interactive login entirely with a long-lived token:

  1. claude setup-token on a machine with a browser → authorize → copy the sk-ant-oat01-… token.
  2. Set CLAUDE_CODE_OAUTH_TOKEN in ~/.claude/settings.json (env block) on the headless host.

Headless claude -p then authenticates reliably (confirmed working even with the env var stripped — it reads the token directly from settings.json). The interactive headless login copy-link remains broken, which is what this report is about.

Suggestion

For SSH/headless sessions:

  • print the full OAuth URL plainly to stdout (not only inside an alt-screen TUI element), and/or
  • surface claude setup-token prominently in the login flow / docs as the headless path.

Related issues

Same failure class, filed separately because here the host has no browser at all, so the broken copy is fully login-blocking: #72008 (TUI 'c' won't copy, mouse-capture blocks selection), #70857 (alt-screen mode breaks terminal copy), #75907 (copy /login URL fails most of the time).

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗