Twitter-登录请求失败
我正在尝试使用Twitter签署请求,以便获得请求令牌并被卡住。我在他们的文档中使用了twitter使用的信息,以确保正确设置了t等格式。我具有相同的Basestring和Key,但仍然没有获得相同的Signature。我看了其他几个例子,似乎也做了同样的事情。
希望有帮助来解决这个问题!
这是代码:
private function sign_request($http_method, $url, $params, $oath)
{
// SET BASE STRING
$sign_params = $this->set_sign_params($params, $oath);
$sign_url = $this->set_sign_url($url);
$base_string = $this->set_sign_basestring($http_method, $sign_params, $sign_url);
print $base_string; // Output the same as the twitter example: POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%3A%2F%2Flocalhost%3A3005%2Fthe_dance%2Fprocess_callback%3Fservice_provider_id%3D11%26oauth_consumer_key%3DGDdmIQH6jhtmLUypg82g%26oauth_nonce%3DQP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1272323042%26oauth_version%3D1.0
// GET HMAC-SHA1 SIGNATURE
if($this->signature_method == \'HMAC-SHA1\')
{
// SET KEY
$key = $this->set_sign_key();
print $key; // Output the same as the twitter example: MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98&
//SIGN
$signature = base64_encode(hash_hmac(\'sha1\', $base_string, $key, true));
print $signature; // DO NOT output the same as the twitter example. Twitteroutput: 8wUi7m5HFQy76nowoCThusfgB+Q= and my outout: Ewqbgi+AMRZGMcqwQTjhE5/ZD80=
}
return $signature;
}
我错过了什么?有人知道吗?
还有一个“有趣”的事情是,如果我在twitter示例中将签名设置为一个,我仍然无法获得请求令牌...
先谢谢了!
没有找到相关结果
已邀请:
1 个回复
襄挟款籍
您的:
区别在于变量“ 3”。 Twitter的:
您的: