Headless /login: OAuth URL can't be copied ('c' fails over SSH), blocking login on browserless hosts
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
ccopy 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
cplaced 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
- SSH into a headless Linux host (no browser) with expired or missing credentials.
- Start
claude(interactive). - At the login screen, try to copy the OAuth URL — press
c, or try to select the text. - Observe that the URL can't be obtained, so login cannot be completed.
Workaround used
Bypassed interactive login entirely with a long-lived token:
claude setup-tokenon a machine with a browser → authorize → copy thesk-ant-oat01-…token.- Set
CLAUDE_CODE_OAUTH_TOKENin~/.claude/settings.json(envblock) 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-tokenprominently 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).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗