Decap CMS OAuth Proxy — Cloudflare Worker

Handles the GitHub OAuth handshake for Decap CMS’s backend: github mode. Deploy worker.js via the Cloudflare dashboard (Workers & Pages → Create → paste this code).

Deployment order (see chat history for full walkthrough)

  1. Create the Worker in Cloudflare, paste worker.js, deploy — note the resulting URL (e.g. https://something.workers.dev)
  2. Create a GitHub OAuth App using that Worker’s URL + /callback as the Authorization callback URL
  3. Copy the OAuth App’s Client ID and Client Secret into the Worker’s Settings → Variables and Secrets as GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET
  4. Update admin/config.yml’s base_url in the main site repo to the Worker’s URL