Wrangler Login Guide for Headless Ubuntu

If you are running on a headless machine without a browser, follow these steps to authenticate Wrangler:

Method 1: API Token (Recommended)

  1. Generate Token: Go to Cloudflare API Tokens and create a token using the Edit Cloudflare Workers template.
  2. Set Environment Variable: Run the following in your terminal:
    export CLOUDFLARE_API_TOKEN="your-api-token-here"
  3. Verify:
    npx wrangler whoami

Method 2: Manual Login (No-Browser)

If you prefer the OAuth flow:

  1. Run:
    npx wrangler login --no-browser
  2. Copy the URL provided and open it in a browser on your local machine.
  3. After authorizing, follow the instructions in the terminal to complete the link.

Shared by Wallie