Skip to content

Add Cloudflare Zero Trust OAuth2 Provider - #13378

Closed
imtia33 wants to merge 2 commits into
appwrite:mainfrom
imtia33:feature/cloudflare-oauth
Closed

imtia33 wants to merge 2 commits into
appwrite:mainfrom
imtia33:feature/cloudflare-oauth

Conversation

@imtia33

@imtia33 imtia33 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds support for Cloudflare Zero Trust as an OAuth2 provider.
This implementation follows the multi-field JSON-blob secret pattern (similar to Microsoft) to store the required Cloudflare team alongside the clientSecret. It also utilizes the PKCE flow required by Cloudflare OIDC.

Test Plan

  • Added unit tests mimicking the existing OAuth2 provider tests (CloudflareTest.php).
  • Test have yet to be done , I am restricted by need of huge mobile data needed for running the test in docker , will submit the tests when I get the data plan.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@greptile-apps

greptile-apps Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Cloudflare Zero Trust as an OAuth2 provider, including PKCE authentication and storage of the team name alongside the client secret.

  • Registers the provider, project configuration route, response model, and provider-list integration.
  • Adds Cloudflare token, refresh, user-info, and credential-verification behavior.
  • Declares the team response field, resolving the previously reported serialization issue.
  • Extends OAuth2 and PKCE test coverage for the provider.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
src/Appwrite/Utopia/Response/Model/OAuth2Cloudflare.php The model now declares the team rule, so runtime serialization and generated response contracts retain the field emitted by the Cloudflare configuration endpoint.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Cloudflare/Update.php Adds the Cloudflare configuration endpoint and consistently persists and returns the client ID, concealed secret, team name, and enabled state.
src/Appwrite/Auth/OAuth2/Cloudflare.php Implements Cloudflare Zero Trust OAuth2 with PKCE, token refresh, user-info retrieval, and credential verification.
src/Appwrite/Utopia/Response/Model/OAuth2ProviderList.php Adds the registered Cloudflare response model to the discriminated OAuth2 provider list.

Reviews (2): Last reviewed commit: "Align Cloudflare provider with establish..." | Re-trigger Greptile

- Cover Cloudflare in the shared PKCE test matrix and drop the
  provider-specific unit test
- Declare the team rule on the response model so GET/PATCH responses
  include it
- Authenticate the credentials probe with client_secret_post only and
  use a URL-shaped redirect_uri plus code_verifier so shape validation
  cannot mask invalid credentials
- Keep oAuthProviders.php alphabetical

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants