drmovi / socialiteprovidersslackv2
Laravel Socialite 的 Slack OAuth2 提供者
v1.0.0
2022-10-27 19:25 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- socialiteproviders/manager: ~4.0
This package is not auto-updated.
Last update: 2024-09-28 02:03:14 UTC
README
composer require drmovi/socialiteprovidersslackv2
安装与基本用法
请参阅基本安装指南,然后按照以下特定提供者的说明操作。
在 config/services.php
中添加配置
'slack' => [ 'client_id' => env('SLACK_CLIENT_ID'), 'client_secret' => env('SLACK_CLIENT_SECRET'), 'redirect' => env('SLACK_REDIRECT_URI') ],
添加提供者事件监听器
配置包的监听器以监听 SocialiteWasCalled
事件。
在 app/Providers/EventServiceProvider
中的 listen[]
数组中添加此事件。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\Slack\SlackExtendSocialite::class.'@handle', ], ];
用法
现在您应该能够像常规使用 Socialite 一样使用此提供者(假设您已安装了外观)
return Socialite::driver('slack')->redirect();
返回的用户字段
id
name
email
avatar
organization_id