4
我試圖從此查詢中獲得結果。Twitter API 1.1無法驗證您2
https://api.twitter.com/1.1/search/tweets.json?q=?&geocode=39.893280,32.779655,5km&count=100
我收到code:32 Could not authenticate you
錯誤。我正在使用解析雲代碼。
Parse.Cloud.httpRequest({
method: 'GET',
url: urlLink,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization" : 'OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"'
},
body: {
},
success: function(httpResponse) {
// console.log(httpResponse.text);
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response ' + httpResponse.status + ' , ' + JSON.stringify(httpResponse));
}
});
我產生了從here。所以密鑰和簽名是正確的。可能我提供的urlLink格式不正確,但我檢查了幾次。這裏有什麼問題?
這裏是工作正確的捲曲代碼。換行符只是爲了更好的可讀性。
curl --get 'https://api.twitter.com/1.1/search/tweets.json'
--data 'count=100&geocode=39.893280%2C32.779655%2C5km&q=%3F'
--header 'Authorization: OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"' --verbose
'q =?'是什麼?這不應該是你的搜索字詞嗎? – Phil 2015-03-31 00:39:44
搜索指定位置的所有內容。像SELECT * – Thellimist 2015-03-31 08:34:39
然後它應該是URL編碼就像它是在你的捲曲請求 – Phil 2015-03-31 20:09:55