Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

496
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!