Skip to content

feat(oauth2): add Webflow provider - #13946

Merged
HarshMN2345 merged 9 commits into
mainfrom
fix/issue-8577
Sep 29, 2026
Merged

HarshMN2345 merged 9 commits into
mainfrom
fix/issue-8577

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

What does this PR do?

Adds Webflow as an OAuth2 provider.

A provider needs seven touch points on current main, found by reading the Kick adapter's own commit (15f94d99ca): the adapter, the config entry, a Response model plus its MODEL_ constant, registration in app/init/models.php, a per-provider Project OAuth2 Update action, its entry in Base::getProviderActions(), and its addAction in Project\Services\Http. It also has to appear in the OAuth2ProviderList union and in the SDK response model list on the per-provider get.

The adapter follows Twitch.php rather than Kick.php, since Webflow documents no PKCE. Endpoints were taken from Webflow's own documentation rather than assumed: authorize https://webflow.com/oauth/authorize, token https://api.webflow.com/oauth/access_token, user https://api.webflow.com/v2/token/authorized_by.

refreshTokens() is a no-op because Webflow exposes no refresh grant. It is unreachable in practice — the session refresh path is guarded on a non-empty refresh token, and Webflow never issues one.

Test Plan

  • composer lint on all changed files → {"tool":"pint","result":"passed"}
  • vendor/bin/phpunit tests/unit/Auth/OAuth2 tests/unit/General/OAuthProvidersTest.php → 95 tests, 414 assertions, passing, run and watched. The one warning is environmental (Swoole\Timer absent on the host) and reproduces on unmodified code.
  • Verified the provider serializes through the real Response::output() path rather than assuming: OAuth2Webflow declares '$id' => 'webflow' and is now named in the OAuth2ProviderList union, which is what output() matches against.

Worth noting for reviewers: the first cut of this change registered the provider everywhere except the OAuth2ProviderList union. Because output() resolves each list entry by matching $id against the union's candidate models, that would have made GET /v1/project/oauth2 return 500 for every project on the instance, not just ones using Webflow. It is fixed here, and an audit of all 48 enabled providers confirmed Webflow was the only one missing from that union.

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? — adds a provider and a route, so specs need regenerating before merge

Sign in with a Webflow account through the authorization code flow:
authorize at webflow.com/oauth/authorize, exchange the code at
api.webflow.com/oauth/access_token, and read the account from
/v2/token/authorized_by under the authorized_user:read scope.

Webflow returns no refresh token and exposes no refresh grant, so
refreshTokens has nothing to exchange.
The provider list resolves each entry by matching its $id against the
candidate models named in OAuth2ProviderList, so a provider missing from
that union makes GET /v1/project/oauth2 throw "Missing model for rule"
for every project. Add Webflow there, and to the SDK response model list
on the per-provider get so the generated spec carries its shape.

Also place the entry after WordPress in the four descending registries
it was inserted ahead of.
@ghost

ghost commented Sep 28, 2026 •

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The new credential check can accept an unsuccessful or malformed response as proof that credentials are valid, and its behavior lacks coverage.

Adds Webflow OAuth2 login and project configuration, including provider registration, response models, and SDK metadata. The newest commit adds a credential check when Webflow is enabled, using an intentionally invalid authorization code at Webflow’s token endpoint.

Latest changes: The newest commit adds Webflow::verifyCredentials() to check client credentials during project OAuth2 enablement.

Verdict New comments Fixed Still open
✅ Approved 2 0 0
Finding Where
🟡 Reject unexpected token responses during credential verification src/Appwrite/Auth/OAuth2/Webflow.php:182
🟡 Cover Webflow credential validation through the project API src/Appwrite/Auth/OAuth2/Webflow.php:165
📂 Walkthrough · 10
File Change
app/config/oAuthProviders.php Registers Webflow as an OAuth2 provider.
app/init/models.php Registers the Webflow response model.
src/Appwrite/Auth/OAuth2/Webflow.php Implements Webflow login and user retrieval, plus the new credential check.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php Registers the Webflow project provider action.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Get.php Includes Webflow in get-provider SDK response metadata.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Webflow/Update.php Defines Webflow project configuration and example credentials.
src/Appwrite/Platform/Modules/Project/Services/Http.php Registers the Webflow configuration route.
src/Appwrite/Utopia/Response.php Adds the Webflow model identifier.
src/Appwrite/Utopia/Response/Model/OAuth2ProviderList.php Adds Webflow to the provider-list model union.
src/Appwrite/Utopia/Response/Model/OAuth2Webflow.php Defines the Webflow response fields and example credentials.

Reviewed the commits since f1a2590 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds Webflow as a new OAuth2 provider.

The PR appears safe to merge, though Webflow-specific observable behavior still lacks test coverage.

Fix All in Claude CodeFindings

  1. P1 Invalid credentials can enable Webflow ▶
  2. P2 Webflow behavior lacks test coverage ▶
Fix with agent prompt
### Issue 1
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Webflow/Update.php:16-19
When a project enables Webflow with a non-empty but invalid client ID or secret, the update succeeds and marks sign-in as enabled. The shared update path checks credentials only when the adapter implements `verifyCredentials()`, which Webflow does not. This contradicts the endpoint’s promise to reject invalid credentials and can offer users a sign-in method that fails at the provider.

### Issue 2
src/Appwrite/Auth/OAuth2/Webflow.php:105-109
No Webflow-specific test exercises token responses, identity lookup, or the new project update/get/list round trip. A mismatch in provider data or a broken public route could therefore go unnoticed. Cover observable results with stubbed provider responses rather than assertions that mirror source code or configuration.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Webflow as an OAuth2 provider, including its adapter, project configuration route, and response models.

  • Registers Webflow in the provider list and single-provider response paths.
  • Adds a credential check when enabling Webflow.

Reviews (8) · Last reviewed commit: "Merge branch 'main' into fix/issue-8577"

Comment on lines +16 to +19
public static function getProviderClass(): string
{
return Webflow::class;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Invalid credentials can enable Webflow

When a project enables Webflow with a non-empty but invalid client ID or secret, the update succeeds and marks sign-in as enabled. The shared update path checks credentials only when the adapter implements verifyCredentials(), which Webflow does not. This contradicts the endpoint’s promise to reject invalid credentials and can offer users a sign-in method that fails at the provider.

Knowledge Base Used: Project administration

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Webflow/Update.php
Line: 16-19

Comment:
**Invalid credentials can enable Webflow**

When a project enables Webflow with a non-empty but invalid client ID or secret, the update succeeds and marks sign-in as enabled. The shared update path checks credentials only when the adapter implements `verifyCredentials()`, which Webflow does not. This contradicts the endpoint’s promise to reject invalid credentials and can offer users a sign-in method that fails at the provider.

**Knowledge Base Used:** [Project administration](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/project-administration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment on lines +101 to +105
public function getUserID(string $accessToken): string
{
$user = $this->getUser($accessToken);

return $user['id'] ?? '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Webflow behavior lacks test coverage

No Webflow-specific test exercises token responses, identity lookup, or the new project update/get/list round trip. A mismatch in provider data or a broken public route could therefore go unnoticed. Cover observable results with stubbed provider responses rather than assertions that mirror source code or configuration.

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Auth/OAuth2/Webflow.php
Line: 101-105

Comment:
**Webflow behavior lacks test coverage**

No Webflow-specific test exercises token responses, identity lookup, or the new project update/get/list round trip. A mismatch in provider data or a broken public route could therefore go unnoticed. Cover observable results with stubbed provider responses rather than assertions that mirror source code or configuration.

**Knowledge Base Used:**
- [Account authentication and identity](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/account-authentication.md)
- [API platform and request surface](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/api-platform.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/issue-8577 (after).

Metric Before After Change
🚀 Requests/sec 187.31 193.96 ⚪ +3.5%
⏱️ Latency P50 92.14 ms 89.59 ms ⚪ -2.8%
⏱️ Latency P95 217.55 ms 210.25 ms ⚪ -3.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 89.59 210.25 12,483 193.96 -7.3
Account 166.54 328.9 657 10.94 -8.1
TablesDB 86.28 161.65 6,789 108.65 -11.31
Storage 83.08 174.08 3,285 53.82 -13.5
Functions 129.49 252.2 1,752 29.29 -14.13

Top API waits (after)

API request Max wait (ms)
account.name.update 487.98
account.prefs.update 461.9
tablesdb.rows.create 394.35
functions.create 378.46
storage.files.create 378.22

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

Comment on lines +182 to +185
$json = \json_decode((string) $response->getBody(), true);

if (isset($json['error']) && $json['error'] === 'invalid_client') {
throw new \Exception('Webflow application with the provided Client ID and/or Client Secret is invalid.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reject unexpected token responses during credential verification

If Webflow returns a 5xx or a non-JSON response, sendRequest() still returns it and this check treats it as valid credentials. An explicit enabled: true update then persists Webflow as enabled without ever having verified the client; only a recognized token error should count as a successful check.

🟡 Minor · error-handling · Reply if this doesn't apply.

return $this->user;
}

public function verifyCredentials(): void

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cover Webflow credential validation through the project API

The new check decides whether the project update accepts credentials, but there is no Webflow success/failure coverage alongside the existing project OAuth2 API tests (tests/e2e/Services/Project/OAuth2Base.php). A regression that lets invalid credentials enable Webflow would not be caught by the current suite.

🟡 Minor · testing · Reply if this doesn't apply.

@HarshMN2345
HarshMN2345 merged commit ed48848 into main Sep 29, 2026
47 of 48 checks passed
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.

🚀 Enhancement: Add Webflow OAuth Provider

2 participants