Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

Twitter streaming API, NodeJS and 401 Unauthorized error

I'm working on a year old application written in node. There is twitter streaming API implemented and it worked before a couple of months. These days we moved the site on another server and I found that it is not working anymore.

I found that Twitter's API returns

401 Unauthorized

I immediately generated new consumer key, secret and oauth secret and token. I still got the same error. I found the problem in the dev forums. The time on the server was wrong. I put the correct one, with the following shell command:

date +%T -s "15:47:10"

And everything works. I wish Twitter returns something like Wrong server date.. Not 401 Unauthorized.

If you enjoy this post, share it on Twitter, Facebook or LinkedIn.