docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
129 stars 159 forks source link

GenerateAccessToken returns "unsupported_grant_type" on 6.7.0 #422

Closed rjpr closed 2 months ago

rjpr commented 9 months ago

Calling DocuSignClient.GenerateAccessToken on SDK v6.7.0 returns the following exception:

DocuSign.eSign.Client.ApiException: Error while requesting server, received a non successful HTTP code with response Body: {"error":"invalid_grant","error_description":"unsupported_grant_type"} at DocuSign.eSign.Client.DocuSignClient.GenerateAccessToken(String clientId, String clientSecret, String code)

I eventually resolved the issue by downgrading to 6.6.0. After some investigation I suspect this has been caused by the changes to the request body here: https://github.com/docusign/docusign-esign-csharp-client/commit/bbc7e3df590ff5a961fb3efc239405367d3bc380#diff-ba42f5f1289226fd9b2414cf211518bd5cdd7a81e4d5764fe74fb90ee6b2ada7R91

ByungjaeChung commented 9 months ago

Thanks for submitting the issue. I was able to reproduce the same issue and reported internally.

Walouh commented 9 months ago

I had the same issue, and overrided the behaviour of DocuSignClient.GenerateAccessToken. It is indeed related to the changes you mentionned (here : https://github.com/docusign/docusign-esign-csharp-client/commit/bbc7e3df590ff5a961fb3efc239405367d3bc380#diff-ba42f5f1289226fd9b2414cf211518bd5cdd7a81e4d5764fe74fb90ee6b2ada7R91)

I only had to change the contentType of the docusignRequest to add "application/x-www-form-urlencoded" in the GenerateAccesToken implementation.

Looks like so : image

May I open a pull request to bring this fix in the code base ?

kenharris commented 8 months ago

Hi all - the GenerateAcessToken() method should be fixed in the latest 6.8.0 version released today.