6

For my local testing I am trying to get and save the user's access token from slack.

The first step is to get user's permission, I am trying to redirect the user to the following URL -

 https://slack.com/oauth/v2/authorize?scope=commands,bot&client_id=<MY_CLIENT_ID>&redirect_uri=https://localhost:3000/slack-verify/

The request then redirects the user(currently me) to

https://<MY-WORKSPACE>.slack.com/oauth?client_id=<CLIENT_ID>&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fslack-verify%2F&state=&scope=commands%2Cbot&user_scope=&granular_bot_scope=1&team=&install_redirect=&single_channel=0&tracked=1

Ideally it should return with a code in GET parameters, but it displays an error on the screen -

<APP NAME> could not be installed. Error details
Invalid permissions requested

What is wrong here?

Edit : Replaced localhost with an ngrok URL as well, but that does not work as well.

steps to reproduce

 https://slack.com/oauth/v2/authorize?scope=commands,bot&client_id=<MY_CLIENT_ID>&redirect_uri=https://localhost:3000/slack-verify/

just put your client id and redirect uri local if any.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
whatf
  • 6,378
  • 14
  • 49
  • 78

2 Answers2

3

Redirecting to your ngrok address generally works perfectly.

To make it work you need to

  1. have the ngrok app running your your local machine and
  2. include your personal ngrok address in the call the Slack.

It should look something link this:

https://slack.com/oauth/v2/authorize?scope=commands,bot&client_id=<MY_CLIENT_ID>&redirect_uri=https://12345678.eu.ngrok.io/slack-verify/
Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
-1

In my case, adding im:write permission to the user token scopes was causing this issue. Slack doesn't provide any helpful error message, hence debugging becomes harder.

Changing "User Token Scopes" back to identity.basic and identity.email, made it work.

Krishna
  • 6,107
  • 2
  • 40
  • 43