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
- Click /login — redirects to Cloudflare authorization page
- Authorize the app — Cloudflare redirects back to
/callback with a code
- Worker exchanges the code for
access_token + refresh_token (PKCE, no secret)
- Tokens are stored in KV
- Click /test-all to validate everything works