Curl 如何撤销闲置代币?

Curl 如何撤销闲置代币?,curl,slack,slack-api,Curl,Slack,Slack Api,我知道slack API auth.revoke,但当我使用它时,它不起作用 我通过在终端中输入它来尝试以下操作,其中是松弛令牌 curl-ihttps://slack.com/api/auth.revoke H“授权:持票人” 我得到的错误是: {"ok":false,"error":"not_authed"}curl: (6) Could not resolve host: H curl: (3) Port number ended with ' ' 我希望看到,{“ok”:true,“r

我知道slack API auth.revoke,但当我使用它时,它不起作用

我通过在终端中输入它来尝试以下操作,其中
是松弛令牌

curl-ihttps://slack.com/api/auth.revoke H“授权:持票人”

我得到的错误是:

{"ok":false,"error":"not_authed"}curl: (6) Could not resolve host: H
curl: (3) Port number ended with ' '

我希望看到,
{“ok”:true,“reversed”:true}

您得到这个响应,因为您在技术上没有向API方法提供令牌。在授权标头中提供令牌仅适用于支持JSON中的POST正文的方法。不支持官方文件中所述的:

将参数作为参数显示在
应用程序/x-www-form-urlencoded querystring
或POST正文中。此方法当前不接受
application/json

以下是curl的正确语法:

curl https://slack.com/api/auth.revoke -X POST --data "token=TOKEN"

您得到此响应是因为您在技术上没有向API方法提供令牌。在授权标头中提供令牌仅适用于支持JSON中的POST正文的方法。不支持官方文件中所述的:

将参数作为参数显示在
应用程序/x-www-form-urlencoded querystring
或POST正文中。此方法当前不接受
application/json

以下是curl的正确语法:

curl https://slack.com/api/auth.revoke -X POST --data "token=TOKEN"