goldendeveloper / instagram
Laravel Socialite 的 Instagram OAuth2 提供者
1.0
2022-08-14 11:52 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- socialiteproviders/manager: ~4.0
README
composer require goldendeveloper/instagram
安装与基本使用
请参阅基本安装指南,然后按照以下特定提供者说明操作。
将配置添加到 config/services.php
'instagram' => [ 'client_id' => env('INSTAGRAM_CLIENT_ID'), 'client_secret' => env('INSTAGRAM_CLIENT_SECRET'), 'redirect' => env('INSTAGRAM_REDIRECT_URI') ],
添加提供者事件监听器
配置包的监听器以监听 SocialiteWasCalled
事件。
将事件添加到您的 app/Providers/EventServiceProvider
中的 listen[]
数组。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \GoldenDeveloper\Instagram\InstagramExtendSocialite::class.'@handle', ], ];
使用方法
现在您应该能够像通常使用 Socialite 一样使用此提供者(假设您已安装了门面)
return Socialite::driver('instagram')->redirect();
返回的用户字段
id
昵称
姓名
头像