【问题标题】:HybridAuth: Authentication failed! LinkedIn returned an invalid TokenHybridAuth:身份验证失败! LinkedIn 返回了一个无效的令牌
【发布时间】:2015-03-11 15:19:06
【问题描述】:

这个问题的可能原因是什么?我遵循this totorial 使用 HybridAuth 和 Laravel 4 通过 LinkedIn 进行身份验证。

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

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

**//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 & Secret?!我必须在 config Array 中使用 Oauth1.0a 吗?

更新:我最终使用了Oauth2-Client

最佳男主

【问题讨论】:

  • 是的,你的问题;还要确保在将它们发布到此处后生成新的...
  • 我把它们改成了 asdf,最好的 M

标签: php laravel-4 linkedin hybridauth


【解决方案1】:

原因是“rw_nus”被贬低了 转到以下文件 LinkedIn.php 并更改“_URL_REQUEST”

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'; 

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2014-05-14
      • 2013-07-05
      • 2017-12-28
      • 2014-10-11
      • 1970-01-01
      • 2018-04-23
      • 1970-01-01
      • 2023-02-01
      • 2014-08-17
      相关资源
      最近更新 更多