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
130 stars 159 forks source link

Receiving the following error from docusign: Error while requesting server, received a non successful HTTP code Error with response Body: #306

Closed neena2504 closed 3 years ago

neena2504 commented 3 years ago

StackTrace: at DocuSign.eSign.Client.ApiClient.RequestJWTUserToken(String clientId, String userId, String oauthBasePath, Byte[] privateKeyBytes, Int32 expiresInHours, List`1 scopes)

Following is my logic to call the Docusign SDK:

            var scopes = new List<string>
            {
                "signature",
                "impersonation",
            };  

var filePath = PrepareFullPrivateKeyFilePath(_docuSignSetting.PrivateKeyFile ?? "");

            var key = ReadFileContent(filePath);
            var apiClient = new ApiClient();

            var authToken = apiClient.RequestJWTUserToken(
                _docuSignSetting.IntegratorKey,
                _docuSignSetting.ImpersonatedUserId,
                _docuSignSetting.AuthServer,
                key,
                1,
                scopes);

            if (authToken != null)
            {
                DocusignAccount = GetAccountInfo(authToken);

// logic to populate User & Session etc.. }

I tried the C# example, works fine. I get the above error only when I call the DocusignService (class library which has the logic to interact with Docusign) through specific pages of my website. It works when I call via couple of pages and doesn't through some.. Everything looks same however I see that Fiddler has the following error when this fails for me. Unable to figure out the reason: "fiddler.network.https> HTTPS handshake to account-d.docusign.com (for #7714) failed. System.Security.Authentication.AuthenticationException A call to SSPI failed, see inner exception. < The message received was unexpected or badly formatted" Also I see that the request has some parts missing when it fails. Any help would be appreciated.

neena2504 commented 3 years ago

@LarryKlugerDS Please assist, we have followed the C# example here https://github.com/docusign/code-examples-csharp I have posted my code above, we still receive an error mentioned above.

LarryKlugerDS commented 3 years ago

There's a StackOverflow answer for this. You're using an older, insecure version of the TLS (SSL) encryption protocol.

PS. Next time, this type of question will be seen sooner if you ask it on StackOverflow with tag docusignapi

Regards, Larry

neena2504 commented 3 years ago

Thank you for your response. I will try this and respond. Sure, thanks for the suggestion!

neena2504 commented 3 years ago

It was resolved after using newer version of TLS, thanks a lot!