Cloudflare OAuth 2.0 Refresh Token Demo

✅ Authenticated - tokens stored

Flow

1. /login → Start OAuth Authorization Code + PKCE flow 2. /tokens → View stored access + refresh tokens 3. /test-api → Call Cloudflare API with current access token 4. /test-api-auto → Auto-refresh if expired, then call API 5. /test-all → Run ALL tests (refresh + API calls)

Manual actions

How it works

  1. Click /login — redirects to Cloudflare authorization page
  2. Authorize the app — Cloudflare redirects back to /callback with a code
  3. Worker exchanges the code for access_token + refresh_token (PKCE, no secret)
  4. Tokens are stored in KV
  5. Click /test-all to validate everything works