douzhi9635 2018-01-19 14:08
浏览 54
已采纳

Laravel。 不支持驱动程序[instagram]。 无法处理回调响应

I'm working on Instagram API and I want to make auth via Instagram. The first step of it - redirect user to IG page. I'm redirecting

return redirect()->away('https://api.instagram.com/oauth/authorize/?client_id='. $this->client_id .'&redirect_uri='. url('instagram/login/callback') .'&response_type=code');

When I log in I get an error - Driver [instagram] not supported

I already wrote IG API credentials in my services.php, ENV file. I created client in instagram website. But everytime, when user loggin in and redirecting back - he gets this error. I'm googling 2 days. I even used 2-3 packages from github for Instagram, but I'm still getting the same error. I cleared caches with every possible ways - all php artisan clear commands, manually deleting cache from /bootstrap dir.

The FB API works perfect, but not this.

Here is my configs:

.env

INSTAGRAM_ID=54c582bd3ea944b78f741c8aac3001ce
INSTAGRAM_SECRET=4a3***********8c

services.php

'instagram' => [
        'client_id' => env('INSTAGRAM_ID'),
        'client_secret' => env('INSTAGRAM_SECRET'),
        'redirect' => '/instagram/login/callback',
    ],

InstagramController.php

class InstagramController extends Controller
{
    private $client_id;

    private $client_secret;

    public function __construct(Request $request)
    {
        $this->client_id = config('services.instagram.client_id');
        $this->client_secret = config('services.instagram.client_secret');

    }



    /**
     * Show Instagram API submit page
     *
     * @return \Illuminate\View\View
     */
    public function getAPIPage(Request $request){

        return redirect()
            ->away('https://api.instagram.com/oauth/authorize/?
             client_id='. $this->client_id .'&redirect_uri='. 
             url('instagram/login/callback') .'&response_type=code');
         }
}

I'm using Laravel Socialite.

What can I do else?

  • 写回答

1条回答 默认 最新

  • doudao1950 2018-01-22 09:45
    关注

    Solved.

    @sam told me to do all things from instructions. I didn't add the listener events before, but when I added it - API worked. I didn't understand why, but we need to add listener classes in EventServiceProvider.php.

    Do step by step: http://socialiteproviders.github.io/providers/instagram/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像