author: Krasimir Tsonev

Hi there, I'm . Senior front-end engineer with over 13 years of experience. I write, speak and occasionally code stuff. Follow me on Twitter, GitHub, Facebook or LinkedIn

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. Or maybe comment below: