I'm attempting to connect to Twitters Streaming API over OAuth using http.get although I'm having a slight problem.
The script keeps returning unauthorised
The code I'm using follows, can anybody tell me if I'm missing something stupid or my headers are incorrect.
var https = require('https');
var options = {
host: 'stream.twitter.com',
path: '/1.1/statuses/filter.json?track=bieber',
method: 'GET',
headers: {
authorization: '
OAuth
oauth_consumer_key = "",
oauth_nonce = "",
oauth_signature = "",
oauth_signature_method = "HMAC-SHA1",
oauth_timestamp = "",
oauth_token = "",
oauth_version = "1.0"
'
}
};
var req = https.request(options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
req.on('error', function(e) {
console.log('Oops... ' + e.message);
});
req.write('data\n');
req.write('data\n');
req.end();