socialiteproviders / angellist
Laravel Socialite 的 AngelList OAuth2 提供商
4.1.0
2020-12-01 23:10 UTC
Requires
- php: ^7.2 || ^8.0
- ext-json: *
- socialiteproviders/manager: ~4.0
README
composer require socialiteproviders/angellist
安装与基本使用
请参阅基本安装指南,然后按照以下特定于提供者的说明操作。
在 config/services.php
中添加配置
'angellist' => [ 'client_id' => env('ANGELLIST_KEY'), 'client_secret' => env('ANGELLIST_SECRET'), 'redirect' => env('ANGELLIST_REDIRECT_URI') ],
添加提供者事件监听器
Laravel 11+
在 Laravel 11 中,默认的 EventServiceProvider
提供者已被移除。相反,您需要在 AppServiceProvider
的 boot
方法中使用 Event
门面上的 listen
方法来添加监听器。
- 注意:除非您用自己的提供者覆盖了它们,否则您不需要为内置的 socialite 提供者添加任何内容。
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { $event->extendSocialite('angellist', \SocialiteProviders\AngelList\Provider::class); });
Laravel 10 或以下
配置包的监听器以监听 `SocialiteWasCalled` 事件。在 app/Providers/EventServiceProvider
中的 listen[]
数组中添加事件。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\AngelList\AngelListExtendSocialite::class.'@handle', ], ];
使用方法
现在您应该能够像常规使用 Socialite 一样使用提供者(假设您已安装门面)
return Socialite::driver('angellist')->redirect();
返回的用户字段
id
name
avatar