问题特征

尝试获取访问密钥时收到错误消息:

{"error":"invalid_grant",
"error_description":"The provided access grant is invalid,
expired, or revoked (e.g. invalid assertion, expired authorization
token, bad end-user password credentials, or mismatching authorization
code and redirection URI).

解决步骤

检查用于重定向 URL 的参数是否为 redirect_uri(如下所示),并将斜体部分替换为您的数据。

curl https://yoursubdomain.zendesk.com/oauth/tokens \
  -H "Content-Type: application/json" \
  -d '{"grant_type": "authorization_code", "code": "your_code",
    "client_id": "your_client_id", "client_secret": "your_client_secret", 
    "redirect_uri": "your_redirect_url", "scope": "read" }' \
  -X POST
重要提示:参数必须是 redirect_uri。

有关更多信息,请参阅文章:对您的应用程序使用 OAuth 身份验证。

由 Zendesk 提供技术支持