socialiteproviders / tiktokshop
TikTok Shop OAuth2 Provider for Laravel Socialite
5.0.0
2025-06-28 23:35 UTC
Requires
- php: ^8.0
- socialiteproviders/manager: ^4.4
This package is auto-updated.
Last update: 2025-06-29 00:12:57 UTC
README
composer require socialiteproviders/manager
Installation & Basic Usage
Please see the Base Installation Guide, then follow the provider specific instructions below.
Configuration
First, add your TikTok Shop app credentials to config/services.php
:
'tiktokshop' => [ 'client_id' => env('TIKTOKSHOP_APP_KEY'), // Your Partner Center App Key 'client_secret' => env('TIKTOKSHOP_APP_SECRET'), // Your Partner Center App Secret 'redirect' => env('TIKTOKSHOP_REDIRECT_URI'), // Your callback URI ],
Make sure you have these in your .env
:
TIKTOKSHOP_APP_KEY=your_partner_center_app_key TIKTOKSHOP_APP_SECRET=your_partner_center_app_secret TIKTOKSHOP_REDIRECT_URI=https://yourapp.com/auth/tiktokshop/callback
Add provider event listener
Laravel 11+
In Laravel 11, register the listener directly in your AppServiceProvider@boot
:
use SocialiteProviders\Manager\SocialiteWasCalled; use App\Providers\Socialite\TikTokShop\TikTokShopExtendSocialite; use Illuminate\Support\Facades\Event; public function boot() { Event::listen(function (SocialiteProviders\Manager\SocialiteWasCalled $event) { $event->extendSocialite('tiktokshop', \App\Providers\Socialite\TikTokShop\Provider::class); }); }
Laravel 10 or below
Configure the package’s listener in app/Providers/EventServiceProvider.php
:
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ \App\Providers\Socialite\TikTokShop\TikTokShopExtendSocialite::class.'@handle', ], ];
Usage
You can now redirect to TikTok Shop for authorization:
use Laravel\Socialite\Facades\Socialite; return Socialite::driver('tiktokshop')->redirect();
And handle the callback:
$shopUser = Socialite::driver('tiktokshop')->user(); // Access mapped fields: $shopUser->getId(); $shopUser->getName(); $shopUser->token; $shopUser->refreshToken; $shopUser->expiresIn;
Returned User fields
id
– the TikTok Shopopen_id
nickname
/name
– theseller_name
token
– theaccess_token
refreshToken
– therefresh_token
expiresIn
– seconds until token expiry