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

153
Visualizações
Stuck on twitter redirect page when trying to save credentials

I'm using the twitter-api-v2 package and I cant save my access_token, access_token_secret and oauth_verifier. i want to save the oauth_verifier because i want to create the actual bot in another file.

Here's what I've found

  • Using writeFile throws me the error in my catch statement
  • Using writeFileSync keeps me stuck on the page, and does not write to the file
  • Trying to tweet something works, the tweet is sent in the background, but i stay stuck on the page
client
    .login(oauth_verifier)
    .then(({ client: loggedClient, accessToken, accessSecret }) => {
      let tokens = {
        accessToken: accessToken,
        accessSecret: accessSecret,
      };
      fs.writeFile("./tokens.json", JSON.stringify(tokens));
      // loggedClient.v2.tweet("hello this is test number: 3"); << this works. i stay stuck
                                                              //on the redirect page, but the tweet is sent
    })
    .catch(() => res.status(403).send("Invalid verifier or access tokens!"));

I was able to save my access_token and access_token_secret the first time i ran this code. but I cannot anymore.

I will also add, to clear any confusion, i am not providing a service. This is a bot that i am creating to practice, and i am not providing a servce. if that is relevant.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

my issue has been resolved. Turns out, the problem was that i was not sending a success response to twitter. I just needed to send a 200 status response in my .then() where i write to my json file.

about 4 years ago · Juan Pablo Isaza 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