Skip to content

Feat 13067 huggingface oauth provider - #13123

Merged
Meldiron merged 12 commits into
appwrite:mainfrom
arpit10128:feat-13067-huggingface-oauth-provider
Aug 19, 2026
Merged

Meldiron merged 12 commits into
appwrite:mainfrom
arpit10128:feat-13067-huggingface-oauth-provider

Conversation

@arpit10128

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR includes the backend implementation required to support Hugging Face authentication, including provider configuration, OAuth2 endpoints, models, and related updates.

Test Plan

Ran the OAuth2 provider tests and confirmed the implementation works as expected.
Screenshot 2026-08-06 154014

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?

@arpit10128

Copy link
Copy Markdown
Contributor Author

@Meldiron Thanks! As suggested, I've opened this as a draft PR. I'd appreciate it if you could take a look when you have a chance.

@ChiragAgg5k
ChiragAgg5k marked this pull request as ready for review August 18, 2026 02:06
@greptile-apps

greptile-apps Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds Hugging Face as a supported OAuth2 provider and wires it through provider configuration, project management endpoints, response models, service registration, and tests. The latest revision fixes the previously reported credential-verification issue by adding the Basic Authorization header with a separate client call.

  • Implements Hugging Face authorization-code exchange, refresh-token handling, user-info retrieval, and credential validation.
  • Registers Hugging Face across project OAuth2 configuration and response models.
  • Updates provider coverage and dependency lock data.

Confidence Score: 5/5

The PR appears safe to merge because the previously reported credential-verification failure has been corrected and no blocking failure remains.

The current implementation sets Content-Type and Basic Authorization through separate header calls before validating Hugging Face credentials, resolving the prior defect; no blocking failure remains.

Important Files Changed

Filename Overview
src/Appwrite/Auth/OAuth2/HuggingFace.php Implements the Hugging Face OAuth2 adapter; the prior missing-Authorization-header issue is resolved by two separate header calls.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/HuggingFace/Update.php Defines the project configuration metadata and response model for the new provider.
app/config/oAuthProviders.php Registers the Hugging Face adapter in the OAuth2 provider catalog.
src/Appwrite/Platform/Modules/Project/Services/Http.php Registers the Hugging Face provider update action with the project HTTP service.
src/Appwrite/Utopia/Response/Model/OAuth2HuggingFace.php Adds the provider-specific project API response model.
tests/unit/Platform/Modules/Project/OAuth2/OAuth2ProviderTest.php Adds Hugging Face to expected OAuth2 provider coverage.

Reviews (5): Last reviewed commit: "chore: bump utopia-php/migration to 2.0...." | Re-trigger Greptile

@Meldiron

Copy link
Copy Markdown
Contributor

I did manual QA, building demo app

Clone this: #13123
Then run it locally.
Then setup an account, a session, an organization, and project inside it.
Then on projet, enable hugging face oauth2 with these credentials:
Client ID: 2ab9cff9-d71....
Client secret: oauth_app_secret_rUtg....
Then build a demo web app with "appwrite" SDK using pure HTML and alpine JS. Have a "Sign in with Hugging Face" button, and after sign-in, a dashboard. Dashboard should have sign-out button, and ability to show acecss token from session. Also a test button to test access token agasint hugging face API.

Screenshots CleanShot 2026-08-18 at 13 13 37@2x CleanShot 2026-08-18 at 13 13 33@2x CleanShot 2026-08-18 at 13 13 44@2x CleanShot 2026-08-18 at 13 13 48@2x

`composer lint` failed on the three new files: array/statement
indentation and whitespace in blank lines in the OAuth2 provider, plus
a missing newline at end of file in all three.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2.0.4 adds 'huggingface' to the OAuth2 provider migration allow-list
(utopia-php/migration#221). Without it, the Appwrite migration source
cannot map the new provider and every migration fails with "No migration
resource for OAuth2 provider 'huggingface'; skipped.", which was breaking
the Migrations E2E suite on this PR.

Reaching 2.0.4 also requires utopia-php/abuse 2.0.1 (within the existing
2.0.* constraint): migration >= 2.0.3 needs the appwrite/appwrite PHP SDK
^27, and abuse 2.0.0 pinned it to ^26. abuse 2.0.1 requires ^27.1, so the
SDK moves 26.1.0 => 27.1.0. Nothing in this repository uses that SDK
directly; it is a transitive dependency of abuse and migration only.

Lock-only change, no composer.json constraints touched.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Meldiron
Meldiron merged commit 000cbad into appwrite:main Aug 19, 2026
158 of 163 checks passed
imtia33 pushed a commit to imtia33/appwrite that referenced this pull request Oct 15, 2026
Appwrite server is adding a built-in 'huggingface' OAuth2 provider
(appwrite#13123). Without an entry in the PROVIDERS allow-list,
migrations fail with "No migration resource for OAuth2 provider
'huggingface'; skipped." — fromArray() returns null before the
isConfigured() check, so the error fires even on projects that never
configured the provider, failing the whole migration.

Only clientId migrates (to the huggingfaceAppid attribute); clientSecret
is write-only and stays redacted per the existing policy. Hugging Face
uses the default clientId/clientSecret field names and has no extra
settings, so there are no TARGET_SECRET fields.

Co-Authored-By: Claude Opus 5 (1M context) <[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.

3 participants