7

I want to be able to provide the admin an option to remove my slack app from their workspace from my website (kind of like add to slack button but reverse of that).

I have a delete button which calls the apps.uninstall method using the user token (XOXP). However I get a not_allowed_token_type error response.

The web method documentation states that i can use an user token (no scopes) for this method. Any ideas what i am doing wrong?

enter image description here

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
r-puri
  • 119
  • 1
  • 5
  • Are you sure you are getting this API error: `not_allowed_token_type`? Can not find any reference about this error on the documentation page. – Erik Kalkoken Sep 12 '18 at 00:36
  • yes, getting this error. I couldn't find reference to it too. I am attaching a screen shot showing this in the post. – r-puri Sep 12 '18 at 03:23

1 Answers1

6

The reason why you get this error is that apps.uninstall only works with workspace apps and workspace tokens. Workspace apps is a new kind of Slack app, that is currently still in development and available under "Developer Preview"

I could not get it to work either for my Slack app, so opened a support ticket and got this answer from the Slack team. Its actually stated in the documentation, but it also wrongly states that you can use a user token. The alternative solution is to use auth.revoke to revoke all tokens from your applications.

Here is what the documentation says:

This method uninstalls a workspace app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of a workspace app.

Here is the reply I got from the Slack team in full:

apps.uninstall is only for workspace apps. There's no way to revoke every token for a traditional app, you'll need to use auth.revoke on each token. This is on the documentation page but its pretty hard to see (and actually incorrect as it states you can use user tokens which is incorrect).

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114