socialiteproviders / tvshowtime
Laravel Socialite的TVShowTime OAuth2提供者
4.1.0
2020-12-01 23:10 UTC
Requires
- php: ^7.2 || ^8.0
- ext-json: *
- socialiteproviders/manager: ~4.0
This package is auto-updated.
Last update: 2024-08-26 21:41:44 UTC
README
composer require socialiteproviders/tvshowtime
安装与基本使用
请参阅基本安装指南,然后按照以下特定提供者的说明进行操作。
在config/services.php
中添加配置
'tvshowtime' => [ 'client_id' => env('TVSHOWTIME_CLIENT_ID'), 'client_secret' => env('TVSHOWTIME_CLIENT_SECRET'), 'redirect' => env('TVSHOWTIME_REDIRECT_URI') ],
添加提供者事件监听器
Laravel 11+
在Laravel 11中,默认的EventServiceProvider
提供者已被移除。取而代之,你可以在AppServiceProvider
的boot
方法中使用Event
外观的listen
方法添加监听器。
- 注意:除非你用自己的提供者覆盖它们,否则不需要为内置的Socialite提供者添加任何内容。
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { $event->extendSocialite('tvshowtime', \SocialiteProviders\TVShowTime\Provider::class); });
Laravel 10或以下
配置包的监听器以监听`SocialiteWasCalled`事件。将事件添加到app/Providers/EventServiceProvider
中的listen[]
数组中。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\TVShowTime\TVShowTimeExtendSocialite::class.'@handle', ], ];
使用方法
现在你应该能够像常规使用Socialite一样使用此提供者(假设你已经安装了外观)
return Socialite::driver('tvshowtime')->redirect();
返回的用户字段
id
昵称
头像