DocuSign error: unauthorized_client while trying to generate access token

Viewed 1689

I'm trying to generate an access_token using DocuSign API using code (https://developers.docusign.com/platform/auth/authcode/authcode-get-token)

I'm calling POST request to: https://account-d.docusign.com/oauth/token

with the following body (application/x-www-form-urlencoded): { "grant_type": "authorization_code", "code": "code that I got after login with the user" }

Authorization: "Basic encodedBase64(integrationKey:SecretKey)"

The error I'm getting is: { "error": "invalid_grant", "error_description": "unauthorized_client" }

I really need help here. Thanks so much

2 Answers

Things to check:

  1. Valid integration key and Secret Key were replaced in Authorization: "Basic encodedBase64(integrationKey:SecretKey)" so it's the actual values you obtained from your DocuSign Developer Account. (the way you had the quotes suggest you have this as a string value without the actual values encoded).
  2. The code is valid for 2 minutes only.
  3. The same IK that was used to obtain the code is used in the header.

Recommend you try the DocuSign eSignature Postman Collection which does it for you and you can see how this was done.

Ran into the same problem while using Postman. Instead of following Docusign video (https://www.youtube.com/watch?v=4cn7Mvmq0Lo&feature=emb_imp_woyt) asking to request an authorization code through web browser and then, using it to obtain an access token, I used Postman's OAuth 2.0 Authorization.

It was pretty easy, just filling all the values under "Configure New Token" and clicked the button "Get New Access Token" which worked and allowed me to use it for any API call.

Related