Twitter Streamig API and HTTP 401 error

For connecting to Twitter Streming API with node.js I used library

var twitter = require("ntwitter"); 
var T = new twitter(
    consumer_key: "",  
    consumer_secret: "", 
    access_token: "", 
    access_token_secret: ""

When calling T.verifyCredentials function I was receiving HTTP 401 error Unauthorized. There is a lot of posts around about what can cause 401 error:

  • wrong api key/secret or wrong access token/secret
  • wrong server time
  • wrong authorization (streaming API is using OAuth)

But in my example none of the above was reason for the problem. The problem was access_token which should be access_token_key but some libraries like use access_token instead of access_token_key. After changing that everything worked perfect.