我正在为 magento 使用 twitter 登录,我配置了所有内容,但是当获取用户信息时,出现以下错误。您的凭据不允许访问此资源 [代码] => 220。如果有人遇到此类问题,请帮助我和提前致谢。我的代码是
$CONSUMER_KEY='xxxxxxxxxxxxxxxxx';
$CONSUMER_SECRET='xxxxxxxxxxxxxxxxxxxxxx';
$OAUTH_CALLBACK='http://demo004.fmeaddons.com';
session_start();
$twitteroauth = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET);
$request_token = $twitteroauth->getRequestToken($OAUTH_CALLBACK);
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
if($twitteroauth->http_code==200){
$url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
echo $url;
$twitteroauth = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$access_token = $twitteroauth->getAccessToken($_GET['oauth_verifier']); $_SESSION['access_token'] = $access_token;
$user_info = $twitteroauth->get('account/verify_credentials');
print_r($user_info);
} else {
die('Something wrong happened.');
}