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

487
Visualizações
Slack users.list api throwing invalid_auth error on passing of valid token as well

I am creating one slack app. So there I need to fetch the team details. So I am calling users.list API. But it's throwing me an invalid_auth error. I verified the token, my token is correct. When I am making request from slack's tester tab it's returning me all the users list of team.

You can see in below image I am getting the correct response but my code is throwing me invalid_auth error.

enter image description here

Below is my code

 import request from 'request';
 const get = async (uri, token) => new Promise((resolve, reject) => {
  request.get(`https://slack.com/api/users.list`, {
    qs: { token }
  }, (_, response) => {
    //some code
  });
});

What I am missing here?

As per Slack's documentation, Either the provided token is invalid or the request originates from an IP address disallowed from making the request. In my case token is correct, so do I need to add IP Address of machine ? if so, where to add it then ?

Would be great if someone can help me out here.

Thanks in Advance!

enter image description here

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0


There seems to be some changes in Slack API authorization.

Instead of passing token as query parameter,
pass it as authorization header.

enter image description here

over 4 years ago · Santiago Trujillo Relatório

0

I had a very similar issue and couldn't figure out what is it all about. Adding token to Authorization header didn't work too.

Everything worked in the Slack tester, but a request from React would always got invalid_auth. After inspecting the request that is sent from the Slack tester, I found it was sent as the form data. To mimic that, I did following:

  const bodyFormData = new FormData();
  bodyFormData.append("token", data.access_token);
  bodyFormData.append("team", slackUser.data.user.team_id);

  const slackTeam = await axios.post(
    "https://slack.com/api/team.info",
    bodyFormData,
    {
      headers: { "Content-Type": "multipart/form-data" },
    }
  );

That was successful.

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