Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

313
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda