ciaranj / node-oauth

OAuth wrapper for node.js
MIT License
2.44k stars 660 forks source link

TypeError: this._encodeData is not a function #332

Closed lnmunhoz closed 6 years ago

lnmunhoz commented 6 years ago

version: 0.9.15; node: 7.10.0;

Tried to run this:

const auth = OAuth(
  'https://api.twitter.com/oauth/request_token',
  'https://api.twitter.com/oauth/access_token',
  CONSUMER_KEY,
  CONSUMER_SECRET,
  '1.0A',
  null,
  'HMAC-SHA1'
);

auth.get(
  "https://api.twitter.com/1.1/trends/place.json?id=23424977",
  ACCESS_TOKEN,
  ACCESS_SECRET,
  (e, data, res) => {
    if (e) return console.error(e);

    console.log('SUCCESS', data);
  }
)

Got this error:

TypeError: this._encodeData is not a function
    at exports.OAuth (/Users/lnmunhoz/workspaces/github/twitter-subscriber-service/node_modules/oauth/lib/oauth.js:15:30)
    at Object.<anonymous> (/Users/lnmunhoz/workspaces/github/twitter-subscriber-service/src/dist/setupTwitterWebhook.js:17:29)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

Any ideas?

lnmunhoz commented 6 years ago

Forgot to create a new instance of OAuth 😅 . SOLVED.