dot-icons

OAuth device-flow proxy

Stateless Cloudflare Worker that forwards POST /device/code and POST /access_token to GitHub’s device-flow endpoints. Exists only because those endpoints don’t support CORS, so a static page can’t call them directly from the browser. Holds no secrets — device flow for public GitHub OAuth Apps only needs the Client ID, which the browser already sends.

Deploy (one-time, per maintainer/environment)

cd demo/oauth-proxy
npx wrangler login
npx wrangler deploy

This prints a *.workers.dev URL. Then:

  1. Put that URL into OAUTH_PROXY_URL in demo/github-upload.js
  2. Put your GitHub OAuth App’s Client ID into CLIENT_ID in the same file (see the file’s header comment for how to register the OAuth App)
  3. If the demo isn’t served from https://digital-ai.github.io, update ALLOWED_ORIGIN in wrangler.toml to match