socialiteproviders/makerlog

为Laravel Socialite提供的Makerlog OAuth2认证服务

4.1.0 2020-12-01 23:10 UTC

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提供者已被移除。相反,您可以在您的AppServiceProviderboot方法中使用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();