Dar Hamid
Dar Hamid

Reputation: 1979

node.js module ntwitter not working

I have tried to use ntwitter node.js module.I have read all the instructions and type the sample code,but it is not working.The code is as follows:

var twit = new twitter({
  consumer_key: 'XXXXXXXXXXXXXXXXXXX',
  consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  access_token_key: 'https://api.twitter.com/oauth/request_token',
  access_token_secret: 'https://api.twitter.com/oauth/access_token'
});
twit.stream('user', {track:'nodejs'},function(stream) {
      console.log('stream==========================',stream);
      stream.on('data', function (data) {
        console.log('=============================================',data);
      });
});

The console.log for stream displays something like this:

stream========================== { buffer: '',
  destroy: [Function],
  _events: { _data: [Function: processTweet] } }

But console.log for data does not display anything.I am stuck and don't know what to do.Can anyone help.

Upvotes: 1

Views: 404

Answers (2)

PanMan
PanMan

Reputation: 1314

I'm looking into a similar issue. Make sure the time on your server is set correctly, otherwise oAuth will fail

Upvotes: 1

FTD
FTD

Reputation: 56

Your access_token_key and access_token_secret values are incorrect. These are supposed be generated keys, not URLs.

There should be a button on your Twitter Developer page to Create Your Access Token. Click it, and use the values provided there instead.

Upvotes: 4

Related Questions