JWT Authentication returning error while matching code examples

Badge +1

I’ve downloaded the DocuSign NuGet package, and also the code examples provided by DocuSign through the quick start for comparing.

I have matched my code to the code examples downloaded within my own project. Confirmed my UserId/ImpersonationId, IntegrationKey/ClientId match from what the code examples use to what my login “Apps & Keys” have.

After attempting to call the “AuthenticateWithJwt(string api, string clientId, string impersonatedUserId, string authServer, byte[] privateKeyBytes)” I get an ApiException of “Error while requesting server, received a non successful HTTP code with response Body: ”

I’ve followed through the documentation on

When using POSTMAN I’m able to get an access token. However, so far I’ve been unsuccessful in getting the DocuSign NuGet package code to work. I’ve tried searching around the forums for any reference to the error response I’m getting with no success.

Any help in pointing me in the right direction would be much appreciated.

4 replies

Userlevel 1
Badge +1

What about RSA keypair, did you create one? do you have the private key file copy/pasted exactly the same into your C# project?

Badge +1

The example project from DocuSign has this:

accessToken = JwtAuth.AuthenticateWithJwt("ESignature", ConfigurationManager.AppSettings["ClientId"], ConfigurationManager.AppSettings["ImpersonatedUserId"],
ConfigurationManager.AppSettings["AuthServer"], DsHelper.ReadFileContent(ConfigurationManager.AppSettings["PrivateKeyFile"]));

The read file definition:

internal static byte[] ReadFileContent(string path)
return File.ReadAllBytes(path);

with the config file of entry of:

<add key="PrivateKeyFile" value="../../../private.key"/>

Within my project

byte[] l_PrivateKeyBytes = DocuSignV2.GetPrivateKeyBytes();
public static byte[] GetPrivateKeyBytes()
return System.IO.File.ReadAllBytes(ConfigurationManager.AppSettings["DocuSignPrivateKeyFile"]);

I use “l_PrivateKeyBytes” as the variable passed on “AuthenticateWithJwt”

The contents of this file is just the RSA Private Key provided within the Apps & Keys > Edit > Generate RSA



Hello Daman,

You can check the walkthrough to set up authentication with JWT Below:

In case you still experience issues, you may need to capture error logs and open a ticket for the support team for further investigation.



Badge +1

Issue was solved. This issue ended up being a security protocol setting.

TLS 1.2+ was needed to be set.