Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Error 401 when tweets using node-twitter

I am using Twitter API by the package Twitter for Node.js.

Right now I succeed reading tweets using stream, but I failed to write tweets. I got 401 error which means Unauthorized according to Twitter Developer Documentation.

The code is here:

const Twitter = require('twitter');

const twitterClient = new Twitter({
  consumer_key: TwitterConsumerKey,
  consumer_secret: TwitterConsumerSecret,
  access_token_key: TwitterAccessTokenKey,
  access_token_secret: TwitterAccessTokenSecret
});

twitterClient.post('statuses/update', { status: 'Hello World!' },  (err, tweet, res) => {
  if (err) throw err;
  console.log(tweet);
  console.log(res);
});

I did give write access. What could be other reasons causing this? Thanks

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I made it work. Before I changed my access from "read" to "read, write, and direct messages". And I did regenerate my "consumer key and secret", also "access token and token secret" several times.

It should work, but it wasn't.

At last I totally delete the app on Twitter and recreated it, then it works!

Hope this can help people who met this weird issue.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!