"invalid_grant" error when requesting an OAuth Token

Issue symptoms

When I attempt to obtain an access token, I receive the error:

{"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).

Resolution steps

Check that the parameter used for the redirect URL is redirect_uri as shown below and replace the sections in italics with your data.

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

Important: The parameter must be redirect_uri.

For more information, see Using OAuth authentication with your application.