Re: [twitter-dev] Streaming API, Basic Auth Ok, OAuth Unauthorized?
Hey Bradley, This is another instance of the the ongoing (and as yet un-answered sadly) question I have in the mailing list about my client (which iirc you're using) See : http://github.com/ciaranj/node-oauth/issues#issue/7 and http://groups.google.co.uk/group/twitter-development-talk/browse_thread/thread/fe6e50d60d1e95fa/f06e93e761183bf1?hl=enlnk=gstq=javajunky#f06e93e761183bf1 oh and also ( :( ) http://groups.google.co.uk/group/twitter-development-talk/browse_thread/thread/4aedc185cee34d81?hl=en# The bad news is twitter don't seem to want to tell me if I'm wrong, or they're wrong (I don't care, just want to know what to fix ! :( ) .. the good news is the work around is to url encode your parameters before you pass them off to my client ( you won't need to do this with any other OAuth provider I've yet come across fwiw, but if they come back and say yes, thats deliberate, yes its different, I'll hardcode it into the client so you don't need to worry about it *sigh* (or even better, the client is wrong, we're right and we do it the same as everyone else..which would be an ideal outcome) ) Take Care - cj. On Mon, Oct 25, 2010 at 10:20 PM, bradley.meck bradley.m...@gmail.com wrote: I have a simple oauth client that I use to post status updates currently, however, when I added the ability to track statuses with the Stream api using OAuth I noticed I could not connect, with Unauthorized 401 being the reply to anything I sent it. I looked into the documentation and it seems to be a simple request using the same OAuth style as the normal api. After searching threads I noticed the rate limiting and so I have left my app alone for extended periods of time and still I get 401s. I tested against basic auth, and the code worked! M, that was odd. So unless I am mistaken I am doing something wrong, but I am posting to the right url and mirroring my basic auth test to no avail. The code is at: http://github.com/bmeck/Simple-Bot/blob/master/modules/twitter.js the track() function is the boilerplate that is in question oa.post is a simple rest wrapper for oauth POST. Any help or directions as to where to go from here is much appreciated. Cheers, Bradley -- 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 -- 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
Re: [twitter-dev] Streaming API Basic Auth
Would JSONP be a fit for your situation? ∞ Andy Badera ∞ +1 518-641-1280 Google Voice ∞ This email is: [ ] bloggable [x] ask first [ ] private ∞ Google me: http://www.google.com/search?q=andrew%20badera On Mon, Mar 15, 2010 at 8:06 PM, Lawrence lipeng...@gmail.com wrote: Hi Everyone, I am developing a Twitter program,which needs to get access for the Twitter streaming API. I can use Http Clients (Apache Wink) to get data from streaming API with no problem. However, my application needs to use JavaScript to access the Streaming API and receive data. I got failure in the first step: trying to pass the basic auth... Instead, i always got the 401 reply from twitter streaming api (unauthorized) Here is some snippet from my code, function send(arg) { CreateXMLHttpRequest(); xmlhttp.onreadystatechange = callhandle; xmlhttp.open(GET,url); xmlhttp.setRequestHeader(Authorization, Basic bXXXyZWXTY4OTE4dHxxlc==); // for my account security reason, i changed the string for my password and user name, but I am pretty sure the string in my original code is correct because I got it from the printing of my successful http clients example. xmlhttp.send(arg); } Is this because the cross-domain restriction? Is there any way which i can use JS to access the streaming API to obtain data? Cheers Lawrence
Re: [twitter-dev] Streaming API Basic Auth
We do indeed have crossdomain.xml disabled on stream.twitter.com. If that's required, you'll have to wait a bit before deploying a Javascript solution. If that isn't the problem, I'd suggest using tcpdump or some other wire inspection tool and see what is transpiring directly. The Streaming API often gives back a useful text nugget. You may have hit a rate limit -- have a cuppa and wait 15 minutes and try again. And finally, as a last resort, you can email your account name and the time of the error, in UTC, to this thread, or directly to me, and I'll poke through the logs. -John Kalucki http://twitter.com/jkalucki Infrastructure, Twitter Inc. On Mon, Mar 15, 2010 at 5:06 PM, Lawrence lipeng...@gmail.com wrote: Hi Everyone, I am developing a Twitter program,which needs to get access for the Twitter streaming API. I can use Http Clients (Apache Wink) to get data from streaming API with no problem. However, my application needs to use JavaScript to access the Streaming API and receive data. I got failure in the first step: trying to pass the basic auth... Instead, i always got the 401 reply from twitter streaming api (unauthorized) Here is some snippet from my code, function send(arg) { CreateXMLHttpRequest(); xmlhttp.onreadystatechange = callhandle; xmlhttp.open(GET,url); xmlhttp.setRequestHeader(Authorization, Basic bXXXyZWXTY4OTE4dHxxlc==); // for my account security reason, i changed the string for my password and user name, but I am pretty sure the string in my original code is correct because I got it from the printing of my successful http clients example. xmlhttp.send(arg); } Is this because the cross-domain restriction? Is there any way which i can use JS to access the streaming API to obtain data? Cheers Lawrence