【问题标题】:Twitter OAuth Fetch 404 ErrorTwitter OAuth 获取 404 错误
【发布时间】:2012-11-17 09:18:53
【问题描述】:

我正在使用 PHP 框架中的 Twitter OAuth,但在通过 Twitter OAuth 流程时遇到了问题。一切似乎都顺利进行,令牌一直匹配到获取用户信息的最后一步。

代码如下:

...
$oauth->setToken($oauth_token, $session->twitter_secret);
$access_token_info = $oauth->getAccessToken(conf::get('TWITTER_OAUTH_ACCESS_URL'));

$session->twitter_state = 2;
$session->twitter_token = $access_token_info['oauth_token'];
$session->twitter_secret = $access_token_info['oauth_token_secret'];
$session->twitter_id = $access_token_info['user_id'];

$oauth->setToken($session->twitter_token, $session->twitter_secret);

if ($oauth->fetch(conf::get('TWITTER_API_URL').'/account/verify_credentials.json'))
{
    ...
}

这里是异常错误输出:

500 exception 'OAuthException' with message 'Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect)' in /var/www/webapp/app/controllers/default/auth.controller.php:135
Stack trace:
#0 /var/www/webapp/app/controllers/default/auth.controller.php(135): OAuth->fetch('https://api.twi...')

现在我不知道为什么会抛出 404 错误。在通过所有身份验证步骤之后发生错误也是没有意义的。

提前感谢您的帮助。

【问题讨论】:

    标签: php twitter twitter-oauth


    【解决方案1】:

    看起来这里描述了解决方案: Getting error with oauth

    看来 Twitter API 现在需要有版本号了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-16
      • 2014-06-01
      • 1970-01-01
      • 2012-11-05
      • 2015-11-06
      • 2014-02-11
      • 2012-01-01
      相关资源
      最近更新 更多