問題の内容

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

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

Powered by Zendesk