vdkar/instagram

4.1.2 2021-07-24 08:26 UTC

This package is auto-updated.

Last update: 2024-09-24 15:08:29 UTC


README

官方包 socialiteproviders/instagram 的分支

修复了非英文账号的国际化问题

Instagram

composer require vdkar/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
        'SocialiteProviders\\Instagram\\InstagramExtendSocialite@handle',
    ],
];

使用方法

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

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

返回的用户字段

  • id
  • 昵称
  • 名字
  • 头像