Problem with twitter API: cannot update status
- by PainBringer
I am trying to create Google Chrome extension that will send interesting links to twitter. But, I am unable to connect to the Twitter. The server gets my request, but the response is always the same: "You do not have permission to access /1/statuses/update.json on this server (403 Forbidden)." I am using Wireshark to inspect Http responses. Here is the code of the function i am using:
function setStatus(msg) {
var status = "status="+msg;
var client = new XMLHttpRequest();
client.open("POST","http://api.twitter.com/1/statuses/update.json");
client.setRequestHeader("Authorization", "Basic <user credentials>");
client.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
client.onreadystatechange = function(){
if(client.readyState ==4){
//whatever
}
}
client.send(status);
Am I doing something wrong? I am using Basic Auth. I use this tool to do the encoding, and just put the result instead of . Also, can someone give me an example of OAuth?