bytespider / jsOAuth

JavaScript implimentation of the OAuth protocol. Currently supports version 1.0 (RFC5849) of the specification. Node.js & CommonJS compatible.
http://bytespider.github.com/jsOAuth/
MIT License
556 stars 108 forks source link

using post in firefox debug mode #5

Closed ghost closed 13 years ago

ghost commented 13 years ago

hey, following fail in firefox with debug mode, while it works in Titanium:

oauth.post("http://api.twitter.com/1/statuses/update.xml",{'status':'test'},function (data) {console.log(data);},function (data) {console.log(data);});

The respone of the twitter server is: Incorrect signature. Regards jume

bytespider commented 13 years ago

Okay looking at the Twitter API, they require the status parameter to be a query string parameter for instance http://api.twitter.com/1/statuses/update.xml?status=jsOAuth%20rocks

in order to do this in jsOAuth at the moment, you'll need to use the request method and set the appendQueryString parameter to true, like this: oauth.request({ method: 'POST', url: 'http://api.twitter.com/1/statuses/update.json', data: {'status': 'jsOAuth rocks'}, success: function (data) { console.log(JSON.parse(data.text);); }, appendQueryString: true });

In a later version of jsOAuth I'll add better URL handling to handle these scenario.

ghost commented 13 years ago

but why is it working in Titanium?

bytespider commented 13 years ago

I've not got it to work in Titanium either, could you provide the code (without the keys and secrets) you are using, along with the version of jsOAuth you are using?

ghost commented 13 years ago

I have did it, like you mailed me.

var oauth = new OAuth({ consumerKey: '', consumerSecret: '', accessTokenKey: '', accessTokenSecret: '' });

oauth.post("http://api.twitter.com/1/statuses/update.xml",{'status':'test'},function (data) { console.log(data); },function (data) { console.log(data); });

bytespider commented 13 years ago

Could you try v0.7.5.1?

ghost commented 13 years ago

works with get and post in firefox( with Privilege true) and also in Titanium (without the privilege option)

bytespider commented 13 years ago

Excellent