I am trying to use jquery to do a get request and download tweets from twitter, except I don't understand how to authenticate the request. I have a twitter account and registered an app, so I can see all its token values. I don't understand how to actually use those values to make a request.
I have this so far:
$(function() {
var token = "<my token>";
$.ajax({
dataType: "json",
url: "https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=episod",
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", token);
},
success: function() {alert(2);},
fail: function() {console.log( "error" );}
});
});
But where do I use the token values?
Can anyone help please?
Thanks