BlogsCloudflareWrangler Authentication

Wrangler Authentication

Wrangler Authentication

2
posts
2019–2020

Cloudflare's Wrangler CLI has evolved its authentication process to improve the developer experience. Previously, users had to manually create API tokens through the Cloudflare dashboard. The new `wrangler login` command streamlines this by allowing users to authenticate directly with their Cloudflare credentials, similar to Argo Tunnel's login flow. This involves generating a public-private key pair, prompting the user to log in via the dashboard, automatically creating a Workers-scoped API token. The CLI's command structure for interacting with Workers KV has also undergone significant iteration, moving from filesystem-like commands to declarative subcommands, and finally to a colon-delimited namespacing pattern (`kv:namespace`, `kv:key`, `kv:bulk`) for improved clarity and usability. This evolution also includes leveraging the `wrangler.toml` configuration file to map human-readable binding names to KV namespace IDs, reducing the need for users to manually manage and input complex IDs.

2020

Improving the Wrangler Startup Experience

8/25/2020

Introduced `wrangler login` command to simplify authentication for Cloudflare Workers. Implemented a secure flow using asymmetric RSA encryption to transfer API tokens from the dashboard to the Wrangler CLI, eliminating the need for manual token creation and pasting. This involved integrating with the EdgeWorker Config Service (EWC) and Cloudflare's front-end infrastructure (Stratus).

2019

How We Design Features for Wrangler, the Cloudflare Workers CLI

9/17/2019

This post details the iterative design process for adding Workers KV functionality to the Cloudflare Workers CLI (Wrangler). It outlines three attempts at designing the command-line interface, highlighting the challenges and lessons learned. The final design adopts a colon-delimited namespacing pattern (`kv:namespace`, `kv:key`, `kv:bulk`) for clarity and leverages the `wrangler.toml` file to map human-readable binding names to KV namespace IDs, improving user ergonomics.