Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

315
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda