request.get('http://localhost:8080/rest/api/2/project',
{
oauth:{
consumer_key:consumer_key,
consumer_secret:consumer_secret,
oauth_signature_method: RSA-SHA1,
token: oauth_access_token,
token_secret: oauth_access_token_secret
},
qs:{user_id:user_id} // or screen_name
},
function (err, res, body) {
console.log(err)
console.log(body)
}
)
答案 0 :(得分:0)
可以在发出get请求时以以下方式传递oauth访问令牌
request.get('http://localhost:8080/rest/api/2/project', {
'auth': {
'bearer': oauth_access_token
},
'qs':{user_id:user_id} // or screen_name
}, function (error, response, body) {
// Do more stuff with 'body' here
})