問題の内容

アクセストークンを取得しようとすると、エラーメッセージが表示されます。

{"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認証の使用」

Powered by Zendesk