【问题标题】:Laravel. Driver [instagram] not supported. Cannot handle the callback response拉拉维尔。不支持驱动程序 [instagram]。无法处理回调响应
【发布时间】:2018-06-28 19:16:06
【问题描述】:

我正在开发 Instagram API,我想通过 Instagram 进行身份验证。第一步 - 将用户重定向到 IG 页面。 我正在重定向

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

登录时出现错误 - 不支持驱动程序 [instagram]

我已经在 services.php, ENV 文件中编写了 IG API 凭据。我在 Instagram 网站上创建了客户端。但是每次,当用户登录并重定向回来时 - 他都会收到这个错误。我在谷歌上搜索了 2 天。我什至使用了来自 github 的 2-3 个包用于 Instagram,但我仍然遇到同样的错误。我用各种可能的方式清除了缓存 - 所有 php artisan clear 命令,从 /bootstrap 目录手动删除缓存。

FB API 运行良好,但不是这样。

这是我的配置:

.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');
         }
}

我正在使用 Laravel Socialite。

我还能做什么?

【问题讨论】:

  • 你在使用 laravel socialite 吗?
  • 是的,我正在使用社交名流
  • 你添加了吗? \SocialiteProviders\Manager\ServiceProvider::class,
  • 是的。我说 FB 运行良好
  • 做一些缓存和配置清除,我记得我在linkedin有这样的错误,一段时间后错误消失了

标签: php laravel instagram-api


【解决方案1】:

解决了。

@sam 告诉我按照指示做所有事情。我之前没有添加监听器事件,但是当我添加它时 - API 起作用了。我不明白为什么,但我们需要在 EventServiceProvider.php 中添加监听类。

一步一步做: http://socialiteproviders.github.io/providers/instagram/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-06
    • 2021-09-14
    • 2021-01-19
    • 2021-02-20
    • 2014-06-04
    • 1970-01-01
    • 1970-01-01
    • 2018-03-21
    相关资源
    最近更新 更多