在使用Laravel 4和php联盟OAuth2时出现一个奇怪的错误


Getting a weird error when working with Laravel 4 and the php league OAuth2

我正在尝试使用Laravel和The League OAuth2客户端在Facebook上获得社交登录,但是我收到此错误:

Required option not passed: access_token Array ( [{"error":{"message":"Error_validating_client_secret_","type":"OAuthException","code":1}}] => )

我已经按照软件包 github 页面中的说明进行操作,但我无法让它工作。

我的控制器操作代码:

 $facebook = $this->socialRepository->facebookLogin();
    $code = 'Input::get("code");
    if(!isset($code)) {
        $authURL = $facebook->getAuthorizationUrl();
        return 'Redirect::away($authURL);
    } else {
        $token = $facebook->getAccessToken('authorization_code', ['code' => $code]);
        try {
            $userDetails = $facebook->getUserDetails($token);
            dd($userDetails);
        } catch ('Exception $e) {}
    }

和存储库代码:

public function facebookLogin()
{
    return new Facebook(
        [
            'clientId'      => $this->config->get("social.facebook.clientID"),
            'clientSecret'  => $this->config->get("social.facebook.clientSercret"),
            'redirectUri'   => $this->config->get("social.facebook.redirectUri"),
            'scopes'        => $this->config->get("social.facebook.scopes"),
        ]
    );
}

这通常发生在重定向 URL、应用 ID 或密钥不正确时。例如

'clientSecret'  => $this->config->get("social.facebook.clientSercret"),

你是说social.facebook.clientSercret而不是social.facebook.clientSecret(没有额外的r