ciaranj / node-oauth

OAuth wrapper for node.js
MIT License
2.44k stars 662 forks source link

401 unauthorized - twitter streaming api #86

Open akaiworld opened 12 years ago

akaiworld commented 12 years ago

When trying to make a get request(as described in wiki) to the twitter's streaming api i get the answer 401/unauthorized.

Requests to the rest api work well with the same get method and the same oauth _access_token/secret_token.

PS In wiki the request is via http. Twitter does not accept it at all. To https returns described result

akaiworld commented 12 years ago

nobody's here =(

pnegri commented 12 years ago

Hey man. This is a issue related to Agent maxSockets of node. It defaults with 5 only open connections to the same domain/ip. Raise this default node setting and it should work.

ciaranj commented 12 years ago

pnegri, how do you know that it's related to the 5 connection max? There's only 1 connection happening in that description?

pnegri commented 12 years ago

Was having one problem related to how much OAuth tokens possible to get per second, and had the problem with streaming too. The first fix is increase connection max request. The second fix its to try again when you get 401.

ciaranj commented 12 years ago

Weird... very odd that max connections would help! (in fact twitter might count this against you) ..trying again would though ... usually the answer to this question is (oddly) they're not using quite the right subdomain on twitter (seriously)

pnegri commented 12 years ago

Then, sorry for any confusion. :)

ciaranj commented 12 years ago

;) Sorry I didn't meant to criticise, just was interested in what you'd spotted!

akaiworld commented 12 years ago

Thank you for the answer. Tried to change http.Agent.maxSockets = 100; did not help, the same result. Also tried http.globalAgent.maxSockets = 100; and http.Agent.defaultMaxSockets = 100; did not help neither...

If it matters, i use http.createServer(function(request, response) { ... }); and socket.io

during the test one client is connected. and the oauth data was already retrieved before the test

ilanbiala commented 10 years ago

+1 on getting this fixed, Twitter streaming API access is really important.