kyoya0819/socialite-slack
Composer 安装命令:
composer require kyoya0819/socialite-slack
包简介
Slack OAuth2 Provider for Laravel Socialite
README 文档
README
Documentation
This package makes use of the SocialiteProviders package located here.
Install the package
composer require mpociot/socialite-slack
Install the Service Provider
-
Remove
Laravel\Socialite\SocialiteServiceProviderfrom your providers[] array in config\app.php if you have added it already. -
Add
\SocialiteProviders\Manager\ServiceProvider::classto your providers[] array in config\app.php.
Install the event listener
-
Add
SocialiteProviders\Manager\SocialiteWasCalledevent to your listen[] array in<app_name>/Providers/EventServiceProvider. -
The listener that you add for this provider is
'Kyoya\Socialite\Slack\SlackExtendSocialite@handle',.
For example:
/** * The event handler mappings for the application. * * @var array */ protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // add your listeners (aka providers) here 'Kyoya\Socialite\Slack\SlackExtendSocialite@handle', ], ];
Environment variables
If you add environment values to your .env as exactly shown below, you do not need to add an entry to the services array.
Append to .env
// other values above
SLACK_KEY=yourkeyfortheservice
SLACK_SECRET=yoursecretfortheservice
SLACK_REDIRECT_URI=https://example.com/login
Append to config/services.php
You do not need to add this if you add the values to the .env exactly as shown above. The values below are provided as a convenience in the case that a developer is not able to use the .env method
'slack' => [ 'client_id' => env('SLACK_KEY'), 'client_secret' => env('SLACK_SECRET'), 'redirect' => env('SLACK_REDIRECT_URI'), ],
Usage
Redirect to Slack with the scopes you want to access:
return Socialite::with('slack')->scopes([ 'identity.basic', 'identity.email', 'identity.team', 'identity.avatar' ])->redirect();
License
MIT :)
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-22