【发布时间】:2015-11-01 12:29:29
【问题描述】:
使用 API 验证
var oauth2 = new OAuth2('Consumer Key', 'Consumer Secret', 'https://api.twitter.com/', null, 'oauth2/token', null);
oauth2.getOAuthAccessToken('', 'grant_type': 'client_credentials' }, function (e, access_token) {
console.log(access_token); //string that we can use to authenticate request
requestURL = {
url: 'https://api.twitter.com/1.1/statuses/user_timeline?user_id=' + userid,
headers: {
Authorization: 'Bearer ' + access_token
}
};
request(URL, function(error, response, body){
console.log(request);
console.log(body); }
使用此代码,我得到 403 Forbidden,但在其他 API 上使用相同的代码,例如搜索/推文,它工作正常。 我在这里想念什么? 不,用户不是私人用户。
【问题讨论】:
标签: javascript node.js twitter twitter-oauth