Forum Academy Marketplace Showcase Pricing Features

Manual OAuth2 for Slack: invalid_auth

I’m trying to set up OAuth2 manually so my users can sign up and log in with Slack. I’ve been following ambroisedlg’s guide but the Slack setup is different and I’m getting stuck. Hopefully someone can help!

Here’s what I’ve done so far:

  1. Create a button (Sign up with Slack) that takes you to a new page (slack_auth)
    image

  2. Create the slack_auth page (complete with loading animation) and the following workflows:

image

image

image

image

image

  1. Create API call for getting an access token:

and for accessing User Information:

Slack doesn’t appear to require token refreshes so I skipped the steps for handling that and have tried to put the authentication token returned using the ‘Get Token’ API call (code=****** in the URL) into the ‘User Info’ API call as the token. Every time I try to initialize this call it returns “invalid_auth” which according to the documentation means my token is no good or my IP isn’t allowed to make requests. I assume my IP hasn’t been black listed by Slack so why is my token not being accepted?

Huge thanks to anyone who can help, I’ve been stuck on this for days.

In case this can be helpful to anyone else, here is the solution:

Despite Slack documentation showing the userInfo call as a GET method, calling a POST method finally got this to work. Here are screenshots of my API calls for getting the access token and collecting the User Info:

Note that the Content-Type in both cases is: application/x-www-form-urlencoded
Also, body type for both is Form-data (not JSON!)

1 Like