Skip to content

feat(auth): add TikTok and Kakao OAuth2 providers - #13526

Merged
Meldiron merged 4 commits into
mainfrom
feat-oauth2-tiktok-kakao
Sep 8, 2026
Merged

Meldiron merged 4 commits into
mainfrom
feat-oauth2-tiktok-kakao

Conversation

@Meldiron

@Meldiron Meldiron commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds two new OAuth2 sign-in providers: TikTok (Login Kit) and Kakao (Kakao Login).

Both follow the existing provider shape: an adapter under src/Appwrite/Auth/OAuth2/, an Update action under Project/Http/Project/OAuth2/, a response model, and registration in oAuthProviders.php, models.php, Response.php, OAuth2ProviderList, Base::getProviderActions(), Get and Project\Services\Http.

TikTok

  • Authorize https://www.tiktok.com/v2/auth/authorize/, token https://open.tiktokapis.com/v2/oauth/token/, user info https://open.tiktokapis.com/v2/user/info/.
  • TikTok deviates from OAuth2 naming and calls the client identifier client_key, so the console field is labelled "Client Key" while the API field stays clientId.
  • Scopes are comma-separated. user.info.basic is the narrowest scope that returns an identity, so it is the only default.
  • The user info endpoint returns nothing unless the requested fields are named explicitly, so open_id,union_id,display_name,avatar_url are always requested.
  • Identity is the app-scoped open_id. Login Kit exposes no email, so getUserEmail() returns '' and isEmailVerified() is false (same as Resend).
  • A rejected token request comes back with an error body rather than only an HTTP error status, so the response is checked explicitly instead of relying on request() alone.
  • verifyCredentials() is not implemented — TikTok does not document an error code for bad client credentials, so there is nothing reliable to assert against.

Kakao

  • Authorize https://kauth.kakao.com/oauth/authorize, token https://kauth.kakao.com/oauth/token, user info https://kapi.kakao.com/v2/user/me.
  • The client ID is the app's REST API key; the secret is the one generated under Kakao Login > Security, which must be set to enabled since Appwrite always sends client_secret. Both are called out in the field labels/hints.
  • No scope is requested by default. Kakao drives consent from the items configured on the app and rejects the authorization with KOE205 as soon as a scope is not activated there. Extra consent items can still be passed per request via the existing scopes query param, comma-separated.
  • Kakao reports both is_email_verified and is_email_valid; an address is only treated as verified when both hold and the email consent item was granted.
  • verifyCredentials() probes the token endpoint and rejects on invalid_client (KOE010), matching Hugging Face / Resend / Cloudflare.

Test Plan

  • New unit tests tests/unit/Auth/OAuth2/{TikTokTest,KakaoTest}.php cover the login URL shape (including client_key vs client_id and comma-separated scopes), the token and refresh request shapes, refresh-token retention, provider errors, and claim mapping. docker compose exec appwrite test tests/unit/Auth/OAuth2/ → 71 tests, 441 assertions, green.
  • Full unit suite green (1179 tests).
  • tests/e2e/Services/Project/OAuth2ConsoleClientTest.php and OAuth2CustomServerTest.php green (26 tests each).
  • Verified live on a local stack: PATCH /v1/project/oauth2/{tiktok,kakao} are routed, and both providers appear on GET /v1/console/oauth2-providers with the expected field names and examples.
  • composer lint, phpstan --level 4 on the new files, and composer refactor:check all pass. Spec generation produces projectUpdateOAuth2TikTok / projectUpdateOAuth2Kakao and the oAuth2TikTok / oAuth2Kakao models.

Related PRs and Issues

Follows the same shape as the Cloudflare (#13391) and Resend (#13366) provider additions.

Have you read the Contributing Guidelines on issues?

Yes.

Note for the console

Both providers use icon-tiktok / icon-kakao; the console needs matching icons before they render.

🤖 Generated with Claude Code

TikTok Login Kit names the client identifier client_key, separates
scopes with commas, and answers a rejected token request with an
error body rather than only an HTTP error status. It exposes no
email, so identity comes from the app-scoped open_id.

Kakao drives consent from the items configured on the app and
rejects the authorization (KOE205) as soon as a scope is not
activated there, so none is requested by default; extra consent
items can still be passed per request. It reports both whether the
address is verified and whether it is still valid, and neither is
present until the email consent item is granted.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps

greptile-apps Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds TikTok and Kakao as first-class OAuth2 providers.

  • Implements provider-specific authorization, token exchange, refresh, profile mapping, email-verification, and credential-validation behavior.
  • Registers project configuration actions, provider metadata, response models, and HTTP routes.
  • Updates utopia-php/migration to 2.0.7 so migrations recognize the new providers.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable new issue identified in the changes since the previous review.

The only post-review change updates utopia-php/migration within its existing compatible constraint and does not alter its declared platform or dependency requirements; no outstanding previous findings were provided.

Important Files Changed

Filename Overview
src/Appwrite/Auth/OAuth2/TikTok.php Implements TikTok Login Kit URLs, comma-separated scopes, token error handling, refresh behavior, and identity mapping.
src/Appwrite/Auth/OAuth2/Kakao.php Implements Kakao authorization, token refresh, profile mapping, strict email verification, and credential probing.
src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php Adds TikTok and Kakao to the project OAuth provider-action registry.
src/Appwrite/Platform/Modules/Project/Services/Http.php Registers both provider configuration actions with the project HTTP service.
src/Appwrite/Utopia/Response/Model/OAuth2ProviderList.php Extends the public provider-list response union with TikTok and Kakao models.
composer.lock Updates the compatible migration package lock to version 2.0.7 for the expanded OAuth provider allow-list.

Reviews (4): Last reviewed commit: "chore(deps): pick up the migration OAuth..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat-oauth2-tiktok-kakao (after).

Metric Before After Change
🚀 Requests/sec 194.38 194.51 ⚪ +0.1%
⏱️ Latency P50 88.66 ms 89.28 ms ⚪ +0.7%
⏱️ Latency P95 213.98 ms 210.52 ms ⚪ -1.6%
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.28 210.52 12,540 194.51 -3.46
Account 180.57 327.11 660 10.93 +9.63
TablesDB 85.88 159.35 6,820 109.13 +4
Storage 83.39 180.17 3,300 54.2 +1.92
Functions 134.57 254.5 1,760 29.62 -4.79

Top API waits (after)

API request Max wait (ms)
tablesdb.rows.increment 478.14
account.name.update 463.45
tokens.files.create 399.06
functions.variables.update 391.66
account.prefs.update 390.78

Meldiron and others added 2 commits September 8, 2026 12:54
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
TikTok calls them a client key and a client secret; Kakao issues a
REST API key. Examples follow the real credential formats.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@Meldiron Meldiron left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lgtm

utopia-php/migration 2.0.7 adds the tiktok and kakao entries. Without
them a migration of every OAuth2 provider errors instead of skipping,
reddening MigrationsConsoleClientTest.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Meldiron
Meldiron merged commit a4b1256 into main Sep 8, 2026
45 checks passed
@ChiragAgg5k ChiragAgg5k mentioned this pull request Sep 10, 2026
2 of 4 tasks
This was referenced Sep 23, 2026
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.

1 participant