socialiteproviders/tiktok
TikTok OAuth 2.0 provider for Laravel Socialite. Add TikTok login to your Laravel app using Socialite’s familiar redirect and callback flow. Install with Composer, configure your TikTok client ID and secret, and authenticate users via the socialiteproviders/tiktok driver.
Architecture fit. The package is a thin adapter, not a framework. It implements a single Socialite driver (SocialiteProviders\TikTok\Provider) extending SocialiteProviders\Manager\OAuth2\Provider, and returns the standard SocialiteProviders\Manager\OAuth2\User object. This means it composes cleanly with any existing Laravel authentication stack that already uses Socialite: no new service container bindings, no custom middleware, no session or guard changes. If the product already supports Google/GitHub/Apple login via Socialite, adding TikTok is genuinely a config-and-listener change. If the product does not use Socialite, this package is not a standalone solution — you would be adopting Socialite + the provider manager + this driver as a bundle.
Integration feasibility. High for a Laravel team. The footprint is small: one Composer dependency pair (socialiteproviders/tiktok and socialiteproviders/manager), one event listener registration (SocialiteWasCalled → TikTokExtendSocialite), one config/services.php block (client_id, client_secret, redirect), and two routes (redirect + callback). The advertised usage is literally Socialite::driver('tiktok')->redirect(). Realistic effort for a mid-level Laravel engineer is well under a day for the code path; the schedule risk sits almost entirely on TikTok's developer-portal side, not on the package.
Technical risk.
open.tiktokapis.com endpoint family have changed repeatedly. A driver that is "correct" at release time can silently degrade when TikTok revises its user-info payload or requires PKCE/client_key handling changes.mapUserToObject call — but that also means bugs are your bugs, and forking is trivial. Treat it as a vendorable 200-line file, not a critical third-party platform.Key questions.
user.info.basic vs. expanded), and has our TikTok developer app passed audit — or are we stuck in sandbox with test users?EventServiceProvider)?Stack fit. Native to the Laravel + Socialite stack. The dependency graph is socialiteproviders/tiktok → socialiteproviders/manager → laravel/socialite → Laravel. It is not framework-agnostic and should not be evaluated for Symfony, Slim, or raw-PHP services — in those cases you would write the ~150 lines yourself and skip the SocialiteProviders ceremony entirely.
Migration path. Two entry scenarios:
redirect/callback controllers and token handling with the two Socialite routes. Keep existing user-linking logic (open_id → local user) and the same users table columns; only the transport changes. Expect to discard roughly a controller and a service class.Do not attempt to run both paths in parallel in production — duplicate callback routes and double code-exchange attempts against a single-use authorization code will produce confusing invalid_grant failures.
Compatibility. Verify three things before committing: (a) socialiteproviders/manager major version compatible with the installed laravel/socialite major; (b) Laravel version's event-registration style (Laravel ≤10 uses EventServiceProvider::$listen; Laravel 11+ favors Event::listen in AppServiceProvider or auto-discovery); (c) PHP version floor matching the rest of the app. Pin exact versions in composer.json and commit the lockfile — do not use ^ on a low-adoption package.
Sequencing.
config/services.php; store credentials in the existing secrets manager, not .env committed to disk.open_id, union_id, display_name, avatar_url mapping.Maintenance. Budget a small but non-zero recurring cost. The realistic failure mode is not the package breaking — it is TikTok changing an endpoint or scope and nobody noticing until login conversion drops. Assign an owner to (a) watch the upstream repo for releases, (b) watch TikTok's developer changelog, and (c) re-run the auth smoke test on a quarterly cadence. Because the driver is tiny, a fork-and-patch contingency is cheap; keep the patch path documented in the runbook rather than assuming upstream responsiveness.
Support. Support burden concentrates at the product edges, not in the library: users without a TikTok account, users who deny the consent screen, users whose TikTok app is regionally restricted, and marketing asking "why doesn't TikTok login show my avatar." Ensure the callback handler produces actionable, non-leaky error messages and that login failures fall back to email/password rather than dead-ending. Internal support docs should include the specific TikTok error codes the driver surfaces.
Scaling. Negligible server-side scaling impact — OAuth is one outbound HTTP round trip per login, dwarfed by normal request volume. The real scaling constraints are external: TikTok's API rate limits on the token and user-info endpoints, and TikTok's own availability. Add timeout and retry-with-backoff around the driver call, and never let a TikTok outage block the login page from rendering.
Failure modes to design for.
invalid_grant; must be handled idempotently, not as a 500.Ramp-up. Very low for any engineer already fluent in Laravel and Socialite — hours, not days. The learning cost that does exist is TikTok-domain knowledge: developer-portal navigation, app review, sandbox-vs-production behavior, and scope semantics. That knowledge lives with whoever owns the TikTok app registration and should be written down, because it is the actual scarce resource here, not the package.
How can I help you explore Laravel packages today?