socialiteproviders / makerlog
为Laravel Socialite提供的Makerlog 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:35:04 UTC
README
composer require socialiteproviders/makerlog
安装与基本使用
请参阅基本安装指南,然后按照以下特定提供商的说明操作。
在config/services.php
中添加配置
'makerlog' => [ 'client_id' => env('MAKERLOG_CLIENT_ID'), 'client_secret' => env('MAKERLOG_CLIENT_SECRET'), 'redirect' => env('MAKERLOG_REDIRECT_URI') ],
添加提供者事件监听器
Laravel 11+
在Laravel 11中,默认的EventServiceProvider
提供者已被移除。相反,您可以在您的AppServiceProvider
的boot
方法中使用Event
外观的listen
方法添加监听器。
- 注意:除非您用您自己的提供者覆盖了内置的socialite提供者,否则您不需要添加任何内容。
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { $event->extendSocialite('makerlog', \SocialiteProviders\MakerLog\Provider::class); });
Laravel 10或以下
配置包的监听器以监听`SocialiteWasCalled`事件。将事件添加到您的app/Providers/EventServiceProvider
中的listen[]
数组。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\MakerLog\MakerLogExtendSocialite::class.'@handle', ], ];
使用方法
现在您应该能够像通常使用Socialite一样使用此提供者(假设您已安装外观)
return Socialite::driver('makerlog')->redirect();