【问题标题】:Newbie OAuth issue: Error when trying to use the PHPoAuthLib OAuth lib新手 OAuth 问题:尝试使用 PHPoAuthLib OAuth 库时出错
【发布时间】:2014-05-20 16:12:35
【问题描述】:

我在连接 twitter 时使用此 OAuth 库时遇到问题:

https://github.com/Lusitanian/PHPoAuthLib

我正在使用以下网址进行连接:

http://www.myserver.com/oauth/examples/twitter.php?go=go

我收到以下错误:

致命错误:未捕获异常 'OAuth\Common\Http\Exception\TokenResponseException' 并带有消息 'file_get_contents(https://api.twitter.com/oauth/request_token):无法打开流:HTTP 请求失败! HTTP/1.1 401 Unauthorized ' 在 /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/Common/Http/Client/StreamClient.php:75 堆栈跟踪:#0 /webDeploy/V2/sites/wandexBB/oauth/src /OAuth/OAuth1/Service/AbstractService.php(52): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array) #1 /webDeploy/V2 /sites/wandexBB/oauth/examples/twitter.php(59): OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main} 在 /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/ 中抛出Common/Http/Client/StreamClient.php 第 75 行

请求正文好像是空的。

我在代码中看到正在使用以下参数:

    $_GET['oauth_token'],
    $_GET['oauth_verifier'],

这些参数是什么?我在 Twitter 帐户中看到我在 twitter 上创建了我的应用程序后有各种可用的令牌,这与此有关吗?

我迷路了:/这可能完全是错误的方法。

有人可以帮忙吗?

提前致谢。

【问题讨论】:

    标签: oauth twitter-oauth


    【解决方案1】:

    这个库似乎有一个与 twitter 实现相关的错误。现在使用不同的库并更容易做到这一点:

    https://github.com/sudocode/ohmy-auth

    【讨论】:

      猜你喜欢
      • 2014-01-31
      • 1970-01-01
      • 1970-01-01
      • 2020-04-10
      • 2022-12-24
      • 2011-02-27
      • 1970-01-01
      • 2012-05-29
      • 1970-01-01
      相关资源
      最近更新 更多