Issue
I know about the slack API auth.revoke, but when I use it, it doesn't work.
I am trying the following by inputting it in my terminal, where <TOKEN>
is the slack token.
curl -i https://slack.com/api/auth.revoke H "Authorization: Bearer <TOKEN>"
The error that I am getting is:
{"ok":false,"error":"not_authed"}curl: (6) Could not resolve host: H
curl: (3) Port number ended with ' '
I am expecting to see, {"ok":true,"revoked":true}
Solution
You get this response because you technically did not provide a token to the API method. Providing tokens in an authorization header only works with methods that support a POST body in JSON. auth.revoke
does not support that as it's stated in the official documentation:
Present arguments as parameters in
application/x-www-form-urlencoded querystring
or POST body. This method does not currently acceptapplication/json
.
Here is the correct syntax with curl:
curl https://slack.com/api/auth.revoke -X POST --data "token=TOKEN"
Answered By - Erik Kalkoken