lezhnev74 / laravel-socialite-tiktok-business
为 Laravel Socialite 提供的 TikTok For Business OAuth2 认证提供者
dev-master
2023-09-08 10:21 UTC
Requires
- php: ^8.0
- socialiteproviders/manager: ^4.4
This package is not auto-updated.
Last update: 2024-09-21 14:01:40 UTC
README
composer require lezhnev74/tiktok-business
安装与基本使用
请参阅基础安装指南,然后按照以下特定提供者的说明进行操作。
在 config/services.php
中添加配置
'tiktok' => [ 'client_id' => env('TIKTOK_CLIENT_ID'), 'client_secret' => env('TIKTOK_CLIENT_SECRET'), 'redirect' => env('TIKTOK_REDIRECT_URI') ],
添加提供者事件监听器
配置包的监听器以监听 SocialiteWasCalled
事件。
将事件添加到 app/Providers/EventServiceProvider
中的 listen[]
数组。有关详细说明,请参阅基础安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\TikTok\TikTokExtendSocialite::class.'@handle', ], ];
使用
现在您应该能够像常规使用 Socialite 一样使用此提供者(假设您已安装了 facade)
return Socialite::driver('tiktok')->redirect();
返回的用户字段
- id
- union_id
- name
- avatar