虽然我有一个小问题,但我试图使用http.get通过OAuth连接到Twitters Streaming API。Twitter流媒体API - Node.js返回未经授权的错误(OAuth)
脚本返回保持擅自
我正在使用的代码如下,有谁能够告诉我,如果我失去了一些愚蠢的事或我的标题是不正确的。
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();
您有一个额外的计划** S **在httpss://,同时,您的主机是错误的,看到http://nodejs.org/api/http.html#http_http_request_options_callback示例 – 2013-04-10 19:02:17
我现在有请求工作,但现在我得到未经授权,我的OAuth标头是否正确? – 2013-04-10 19:07:18
所有实际的标题信息在哪里? – 2013-04-10 19:38:17