Twitter API 1.1 无法对您进行身份验证 2
Twitter API 1.1 Could not authenticate you 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 代码。换行只是为了更好的可读性。
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
问题是 ?
我应该写 %3F
这是查询的最新版本
https://api.twitter.com/1.1/search/tweets.json?q=%3F&geocode=39.893280,32.779655,5km&count=100
文档:https://dev.twitter.com/rest/reference/get/search/tweets
q: A UTF-8, URL-encoded search query of 500 characters maximum, including operators
我正在尝试从此查询中获取结果。
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 代码。换行只是为了更好的可读性。
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
问题是 ?
我应该写 %3F
这是查询的最新版本
https://api.twitter.com/1.1/search/tweets.json?q=%3F&geocode=39.893280,32.779655,5km&count=100
文档:https://dev.twitter.com/rest/reference/get/search/tweets
q: A UTF-8, URL-encoded search query of 500 characters maximum, including operators