HybridAuth:身份验证失败! LinkedIn返回了无效的令牌

时间:2015-01-13 15:49:19

标签: php laravel-4 linkedin hybridauth

出现此问题的可能原因是什么?我使用HybridAuth和Laravel 4跟踪this totorial,通过LinkedIn进行身份验证。

我收到此消息:身份验证失败! LinkedIn返回了无效的令牌。

任何想法,也许是因为localhost配置?

enter image description here

**//Configuration Part**
<?php

return
array(
    "base_url" => URL::to('http://localhost:8000/social/auth'),

    "providers" => array (
        "LinkedIn" => array (
            "enabled" => true,
            "keys"    => array ( "key" => "xxx", "secret" => "xxx"),
            "scope" => 'r_basicprofile, r_emailaddress'
        )
    ),

    // if you want to enable logging, set 'debug_mode' to true  then provide a writable file by the web server on "debug_file"
    "debug_mode" => false,

    "debug_file" => "",
); 
?>

在LinkedIn Api,我正在关注密钥:

消费者密钥/ API密钥: 75tgxxxasdfeulcip

消费者秘密/密钥: JtOXIXasdfasdfgpyFvi7

OAuth 1.0a用户令牌: 7b5955fe-6afc-4120-b148-55casdfasdf

OAuth 1.0a用户密码: c7824d63-46c2-4549-bce1-8f5casdfasdf

在HybridConfig中,我正在使用Consumer Key&amp;秘密?!我是否必须在配置数组中使用Oauth1.0a?

更新:我最终使用Oauth2-Client

最佳M

2 个答案:

答案 0 :(得分:0)

HybridAuth正在使用OAuth 1.0,因此请确保您使用为您的应用生成的OAuth 1.0a用户令牌和密钥。

答案 1 :(得分:0)

原因是&#34; rw_nus&#34;被剥夺了我 转到以下文件 LinkedIn.php 并更改&#34; _URL_REQUEST&#34;

const _URL_REQUEST='https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+rw_nus'; 

const _URL_REQUEST='https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress';