ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

oauth/request_token call returns error #466

Open dipbhi opened 6 years ago

dipbhi commented 6 years ago

Calling post on "oauth/request_token" returns an error.

Code:

const twitter = require("twit");

const twtr = new twitter({
    consumer_key: TWTR_CONSUMER_KEY,
    consumer_secret: TWTR_CONSUMER_SECRET,
    access_token: TWTR_ACCESS_TOKEN,
    access_token_secret: TWTR_ACCESS_TOKEN_SECRET,
    app_only_auth: false
  });

  twtr.post("oauth/request_token", {
    "oauth_callback": "[host]/twitter_callback"
  }, function(err, data, response) {
    console.log(data);
  });

It logs: { errors: [ { message: 'Sorry, that page does not exist', code: 34 } ] }

larvata commented 6 years ago

The oauth/request_token is not under the twitter rest api route. Please use the full path to prevent twit generate the wrong url.

  twtr.post("https://api.twitter.com/oauth/request_token", {
    "oauth_callback": "[host]/twitter_callback"
  }, function(err, data, response) {
    console.log(data);
  });