receive "invalid_grant" error when attempting to get access token | Community
Skip to main content

receive "invalid_grant" error when attempting to get access token

  • May 18, 2022
  • 4 replies
  • 0 views

Instructions followed as described here: https://developer.zendesk.com/documentation/live-chat/getting-started/auth/ (which was very difficult to find, by the way!)

Making a POST request to this:

https://www.zopim.com/oauth2/token?grant_type=authorization_code&code=<redacted>&client_id=<redacted>&client_secret=<redacted>&redirect_uri=<redacted>&scope=read

Code is the code as provided to the redirect_uri in the previous step. An API client is active on the account. Response is as follows:

{
    "error": "invalid_grant"
}

What am I doing wrong?

4 replies

Eric27
  • May 18, 2022
Hey Nick,
 
It looks like you're putting the parameters as query strings when you should be including these in the body of the request. If you adjust the request so that the params are in the body as x-www-form-urlencoded key/value pairs it should function as expected.
 
Hope this helps,

  • Author
  • May 30, 2022

Your solution didn't work. Same error.


Eric27
  • May 31, 2022
Hey Nick,

Can you provide your request so we can take a look?

  • Author
  • May 31, 2022

Hi Eric,

I did eventually fix it. The issue was the redirect_uri was http not https. Error description from the API threw me off!

Thanks,

Nick