Preflight Checklist
What's Wrong?
The OAuth login flow fails at the token exchange step when running Claude Code on a Hetzner Cloud VPS. Cloudflare issues a JavaScript challenge that the CLI cannot complete, blocking the outbound HTTPS request.
Steps:
- SSH into VPS, run
claude login
- CLI displays authorization URL
- Open URL in local browser, sign in, authorize successfully
- Receive authorization code, paste it back into the CLI
- CLI fails with: "OAuth error: Request failed with status code 400"
Root cause — Cloudflare blocks claude.ai from the VPS:
$ curl -sS -D - -o /dev/null https://claude.ai/
HTTP/2 403
cf-mitigated: challenge
server: cloudflare
The cf-mitigated: challenge header confirms a JS challenge is being issued. The CLI cannot complete this challenge, so the token exchange request fails.
- Both IPv4 and IPv6 return 403
console.anthropic.com returns HTTP 302 (OK) — only claude.ai is blocked
- Previously authenticated successfully as root on the same server
What Should Happen?
The OAuth token exchange should succeed. The token exchange endpoint should be exempt from Cloudflare bot challenges for CLI/API clients (e.g. by User-Agent or endpoint path), or an alternative headless authentication method should be provided.
Error Messages/Logs
OAuth error: Request failed with status code 400
Full response headers from VPS:
HTTP/2 403
date: Thu, 29 Jan 2026 11:28:40 GMT
content-type: text/html; charset=UTF-8
cf-mitigated: challenge
server: cloudflare
Steps to Reproduce
- Provision a Hetzner Cloud VPS (any plan, ARM64 or x86)
- Install Claude Code via npm
- Run
claude login
- Complete the browser authorization, paste code back
- Observe "OAuth error: Request failed with status code 400"
Claude Model
Claude Pro (subscription)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown — previously worked as root on same server
Claude Code Version
v2.1.23
Platform
Claude.ai (Pro subscription)
Operating System
Ubuntu 24.04.3 LTS (Noble Numbat), ARM64, Hetzner Cloud
Terminal/Shell
Bash via SSH
Additional Information
Preflight Checklist
What's Wrong?
The OAuth login flow fails at the token exchange step when running Claude Code on a Hetzner Cloud VPS. Cloudflare issues a JavaScript challenge that the CLI cannot complete, blocking the outbound HTTPS request.
Steps:
claude loginRoot cause — Cloudflare blocks
claude.aifrom the VPS:The
cf-mitigated: challengeheader confirms a JS challenge is being issued. The CLI cannot complete this challenge, so the token exchange request fails.console.anthropic.comreturns HTTP 302 (OK) — onlyclaude.aiis blockedWhat Should Happen?
The OAuth token exchange should succeed. The token exchange endpoint should be exempt from Cloudflare bot challenges for CLI/API clients (e.g. by User-Agent or endpoint path), or an alternative headless authentication method should be provided.
Error Messages/Logs
Full response headers from VPS:
Steps to Reproduce
claude loginClaude Model
Claude Pro (subscription)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown — previously worked as root on same server
Claude Code Version
v2.1.23
Platform
Claude.ai (Pro subscription)
Operating System
Ubuntu 24.04.3 LTS (Noble Numbat), ARM64, Hetzner Cloud
Terminal/Shell
Bash via SSH
Additional Information