我在我的 zend 框架应用程序中使用 twitter 进行登录。但是在通过 twitter 进行身份验证后,它显示以下错误:
Message:Could not retrieve a valid Token response from Token URL: /oauth/access_token?oauth_consumer_key=xxxxxxxxxxxxxxx&oauth_nonce=xxxxxxxxxxxxxxxxxxxx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1352270857&oauth_token=xxxxxxxxxxxxx&oauth_version=1.0
&oauth_verifier=xxxxxxxxxxxxxxxxxxxxx&oauth_signature=wv5gdop77NA9BeZI7ilQcEFsqGH8CeR4%3D Invalid / expired Token
以下是我的代码:
public function twittercallbackAction() {
$path = realpath(APPLICATION_PATH . '/../library/');
set_include_path($path);
$config = array(
"callbackUrl" => "http://" . $_SERVER['HTTP_HOST'] . "/register/twittercallback",
"siteUrl" => "http://twitter.com/oauth",
"consumerKey" => "xxxxxxxxxxxxxx",
"consumerSecret" => "xxxxxxxxxxxxxxxxxxxx"
);
$consumer = new Zend_Oauth_Consumer($config);
if (!empty($_GET) && isset($_SESSION['TWITTER_REQUEST_TOKEN'])) {
$token = $consumer->getAccessToken($_GET, unserialize($_SESSION['TWITTER_REQUEST_TOKEN']));
// Now that we have an Access Token, we can discard the Request Token
// get users timeline
// $_SESSION['TWITTER_REQUEST_TOKEN'] = null;
} else {
// Mistaken request? Some malfeasant trying something?
exit('Invalid callback request. Oops. Sorry.');
}
}
我正在谷歌上搜索这个问题,但没有得到任何解决方案。
我该如何处理这个问题。
谢谢