Reputation: 1111
This returns a "Bad Authentication Data" error
request.post({
url: "https://api.twitter.com/1.1/statuses/update.json",
oauth: {
consumer_key: auth.twitter.consumerKey,
consumer_secret: auth.twitter.consumerSecret,
access_token_key: this.authToken,
access_token_secret: this.authSecret
},
params: {
status: "Check this out!!"
}
}, function(err, response, body) {
return console.log(err, body); // null '{"errors":[{"message":"Bad Authentication data","code":215}]}'
});
Any idea what I'm doing wrong?
Upvotes: 0
Views: 1353
Reputation: 46
There are a couple of things that are preventing this from running:
access_token_key
should be token
, and access_token_secret
should be token_secret
Sending POST data works a bit differently with the request module. Try something like this
var r = request.post({url:url, oauth:params}, function(err, resp, body) {
res.end("Tweet sent successfully");
});
var form = r.form();
form.append("status", "Check this out!!");
Upvotes: 2