[twitter-dev] Re: API doesn't respond to my status update request. JS - XmlHTTPRequest.
Any thoughts ? On Sep 18, 2:58 pm, Kakysha ezhikvd...@gmail.com wrote: Yes, of course. The oAuth library - is the most (the only one :)) ) popular library for JS - http://oauth.googlecode.com/svn/code/javascript/ from John Kristian. It was adviced on oauth.net The accessor.serviceProvider.actionURL is http://api.twitter.com/1/ statuses/update.json If you need - this are my request headers :https://www.dropbox.com/s/1s4e6u1s8p84yq4/z.png It seems like twitter forces to close the connection (( On Sep 17, 6:31 pm, Taylor Singletary taylorsinglet...@twitter.com wrote: Hi there, What's the value of accessor.serviceProvider.actionURL when you're trying to update status? I'm not familiar with the OAuth library used here, can you tell me more about it? Thanks, Taylor On Fri, Sep 17, 2010 at 3:32 AM, Kakysha ezhikvd...@gmail.com wrote: 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 -- 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
[twitter-dev] Re: API doesn't respond to my status update request. JS - XmlHTTPRequest.
Yes, of course. The oAuth library - is the most (the only one :)) ) popular library for JS - http://oauth.googlecode.com/svn/code/javascript/ from John Kristian. It was adviced on oauth.net The accessor.serviceProvider.actionURL is http://api.twitter.com/1/ statuses/update.json If you need - this are my request headers : https://www.dropbox.com/s/1s4e6u1s8p84yq4/z.png It seems like twitter forces to close the connection (( On Sep 17, 6:31 pm, Taylor Singletary taylorsinglet...@twitter.com wrote: Hi there, What's the value of accessor.serviceProvider.actionURL when you're trying to update status? I'm not familiar with the OAuth library used here, can you tell me more about it? Thanks, Taylor On Fri, Sep 17, 2010 at 3:32 AM, Kakysha ezhikvd...@gmail.com wrote: 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 -- 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