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

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

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 Denunciar

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 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