Hi guys,I am customizing a story map (MapTour Template ) adding a functionality to search geolocated Tweets from the public stream, but new Twitter API require authentication.I created an account and registered my app to obtain keys and tokens but I always get error 403.Here is my code for auth
function oAuth(kwArgs) {
var CONSUMER_KEY = "xxxxxxxxxxx";
var CONSUMER_SECRET = "xxxxxxxxxx";
var token = "xxxxxxxxxx";
var tokenSecret = "xxxxxxxxxx";
var access = {
consumer: {
key: CONSUMER_KEY,
secret: CONSUMER_SECRET
},
user: {
key: token,
secret: tokenSecret
},
sig_method: "HMAC-SHA1"
};
kwArgs.headers= {
'Content-Type': 'application/x-www-form-urlencoded',
};
// our request will be made with the HTTP GET verb
return OAuth.sign("GET", kwArgs, access);
}
and here is the code where I request tweets
function searchTwitter() {
var query = dojo.byId("twitter_input").value;
var geocode = "42.37355,12.88290,1000km";
try {
var results = esri.request(oAuth({
dataType : 'jsonp',
url : "http://api.twitter.com/1.1/search/tweets.json",
content : {
q : query,
geocode : geocode,
count : "100",
include_entities : "false",
result_type : "recent",
},
callbackParamName : "callback",
}));
results.then(addTweets);
} catch (e) {
console.log(e.toString());
}
};
Somebody help, please!