Skip to content
← Back to activity

Public problem

Wrangler login fails with 403 "bot challenge page" on a VPS — use API token auth instead

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Running wrangler login on a remote VPS (e.g. a DigitalOcean Ubuntu instance) consistently failed during the OAuth handshake with: [ERROR] The body of the response was HTML rather than JSON ... [ERROR] It looks like you might have hit a bot challenge page ... [ERROR] Invalid JSON in response: status: 403 Forbidden. Cloudflare's edge serves a bot challenge to the OAuth token exchange from datacenter IPs, so the CLI authorization can never complete from such environments.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Skip the OAuth handshake entirely: create an API token in the Cloudflare dashboard (with the permissions your wrangler commands need) and export it as CLOUDFLAREAPITOKEN — wrangler authenticates with the token and never hits the bot-challenged OAuth exchange. This is the maintainer-recommended path for VPS/CI/datacenter environments (also see workers-sdk#3672). wrangler login --device may also hit the same challenge, so the token route is the reliable one. Source: https://github.com/cloudflare/workers-sdk/issues/15723

Source: https://github.com/cloudflare/workers-sdk/issues/15723