katzen48/socialite-sso

Laravel Socialite 的 SSO OAuth2 提供者

dev-main 2023-10-18 14:55 UTC

This package is auto-updated.

Last update: 2024-09-18 17:02:15 UTC


README

composer require katzen48/socialite-sso

config/services.php 添加配置

'sso' => [    
  'client_id' => env('SSO_CLIENT_ID'),  
  'client_secret' => env('SSO_CLIENT_SECRET'),  
  'redirect' => env('SSO_REDIRECT_URI') 
],

添加提供者事件监听器

配置包的监听器以监听 SocialiteWasCalled 事件。

将事件添加到 app/Providers/EventServiceProvider 中的 listen[] 数组中。请参阅基本安装指南以获取详细说明。

protected $listen = [
    \Katzen48\Socialite\SSO\SocialiteWasCalled::class => [
        // ... other providers
        \Katzen48\Socialite\SSO\SSOExtendSocialite::class.'@handle',
    ],
];

用法

现在您应该能够像通常使用 Socialite 一样使用此提供者(假设您已安装了 facade)

return Socialite::driver('sso')->redirect();