I am attempting to retrieve data from the following query.
https://api.twitter.com/1.1/search/tweets.json?q=?&geocode=39.893280,32.779655,5km&count=100
Encountering an error of
code:32 Could not authenticate you
while using Parse cloud code.
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));
}
});
All necessary details and signatures were generated from this source. The keys and signature are accurate. It is possible that there is a format issue in the urlLink being provided, although I have double-checked it several times. What could be the problem?
The following curl code works flawlessly. Newlines are included for better readability.
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