Repository navigation
feat(auth): add Cloudflare Dashboard OAuth2 provider - #13391
Conversation
Greptile SummaryAdds Cloudflare Dashboard OAuth2 as a configurable authentication provider.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "Use Cloudflare API user details for iden..." | Re-trigger Greptile |
Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Cloudflare OAuth clients cannot be granted the 'openid' scope - the dashboard scope picker and the /oauth/scopes API only offer Cloudflare API permission scopes. Request 'user-details.read' and 'offline_access' instead, and read identity (id, email, name) from the Cloudflare API user details endpoint, which also improves on userinfo's bare 'sub'. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Heads up on two pushed changes after real end-to-end QA against a live Cloudflare OAuth client (the test plan's manual QA was still unchecked): 1. Identity now comes from the Cloudflare API, not OIDC userinfo (877a3ec) The The adapter now requests 2. Setup instructions in the description need updating
Verified: authorize URL accepted by Cloudflare (redirects to login with a challenge), credential verification passes, PKCE unit tests green. 🤖 Generated with Claude Code |








What does this PR do?
Adds Cloudflare as an OAuth2 login provider via Cloudflare Dashboard OAuth2 — the consumer "Login with Cloudflare" flow at
dash.cloudflare.com. Any Cloudflare user can consent to give an Appwrite app access to their Cloudflare account. Use cases include third-party apps that manage DNS, Workers, or other Cloudflare API resources on behalf of the user.This is NOT Cloudflare Zero Trust. Zero Trust is per-tenant corporate SaaS OIDC; Dashboard OAuth2 is global consumer OIDC (Great naming by cloudflare, now I really wont trust anyone , specially if its their name or their service name).
Endpoints
All global:
https://dash.cloudflare.com/oauth2/authhttps://dash.cloudflare.com/oauth2/tokenhttps://dash.cloudflare.com/oauth2/userinfohttps://dash.cloudflare.com/.well-known/openid-configuration(returns 200 with RFC 8414 metadata)Identity
Cloudflare's OIDC discovery doc advertises
claims_supported: ["sub"]— only thesubclaim is exposed via userinfo. No email, name, or picture. Cloudflare users in Appwrite will have empty email and empty name. Account deduplication is via(provider='cloudflare', providerUid=<sub>). Supported by Appwrite thanks to PR #13255 (email optional for OAuth2 account linking).PKCE
Uses Appwrite's
PKCEtrait withS256challenge method — consistent with Etsy, Kick, X, and Appwrite providers.verifyCredentials()usesclient_secret_postonly (no Basic auth header).Setup
Admins register an OAuth client at
https://dash.cloudflare.com→ Manage Account → OAuth clients → Create client. Selectauthorization_codegrant,client_secret_postauth method, redirect URIhttps://<appwrite-host>/v1/account/oauth2/callback/cloudflare, and at least theopenidscope. To allow any Cloudflare user (not just parent-account members) to authorize, promote the client to public visibility — requires client name, logo, client URL, scopes, AND client URL domain ownership verification (DNS TXT). Public promotion is permanent.Reference: https://developers.cloudflare.com/fundamentals/oauth/
Test Plan
openidscope), full OAuth2 callback flow, decode the resulting JWT to confirmsubis presentRelated PRs and Issues
Checklist
composer specis run in CI)