I use XmlHTTPRequest in JavaScript (actually, i write Google Chrome
Extension)
Api successfully gives me all the tokens (i use oAuth OOB) the twitter
returns me a PIN code, then it successfully changed to acces token,
and on the final stage - attemp to update status it doesnt return any
response (((
I try to send Authorization header (i think, all right with it), and i
try to send authorization fields directly in POST body, but nothing ((

My code is :

message = {method: "post", action: accessor.serviceProvider.actionURL,
parameters: [["status","Yahoo"]]};
var requestBody = OAuth.formEncode(message.parameters);
OAuth.completeRequest(message,
{ consumerKey   : accessor.consumerKey
, consumerSecret: accessor.consumerSecret
, token         : token
, tokenSecret   : token_secret
});
var authorizationHeader = OAuth.getAuthorizationHeader("",
message.parameters);
var requestAction = new XMLHttpRequest();
requestAction.onreadystatechange = function() {
if (requestAction.readyState == 4) {
alert(requestAction.status+" "+requestAction.statusText
 +"\n"+requestAction.getAllResponseHeaders()
 +"\n"+requestAction.responseText);
}
};
requestAction.open(message.method, message.action, true);
requestAction.setRequestHeader("Authorization", authorizationHeader);
requestAction.setRequestHeader("Content-Type", "application/x-www-form-
urlencoded");
requestAction.send(requestBody);

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to