socialiteproviders/tiktokshop
最新稳定版本:5.0.0
Composer 安装命令:
composer require socialiteproviders/tiktokshop
包简介
TikTok Shop OAuth2 Provider for Laravel Socialite
README 文档
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_idnickname/name– theseller_nametoken– theaccess_tokenrefreshToken– therefresh_tokenexpiresIn– seconds until token expiry
References
统计信息
- 总下载量: 420
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-29