问题特征
当我尝试获取访问密钥时,收到以下错误:
{"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://{subdomain}.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 身份验证。