pradman pradman - 1 year ago 293
C# Question

EnvelopeApi.CreateEnvelope() (docusign) throws an USER_AUTHENTICATION_FAILED exception

I am using the docusign C# client (

  1. The same code works in the staging ( environment, but fails in the production ( environment.

  2. The same user credentials works with the older docusign sdk (DocuSign.Integration.Client.dll, v1.7.2), but fails with the latest docusign sdk (DocuSign.eSign.dll, v2.0.1)

Here is my code:

var accountId = LoginAndGetAccountId();

var envelopeDefinition = new EnvelopeDefinition
EmailSubject = "Please sign this agreement.",
Status = "sent"


var envelopesApi = new EnvelopesApi();
var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);

I can log in via the API, and get a valid account id. The code bombs with the production environment when I make the "envelopesApi.CreateEnvelope()" call.

An unhandled exception of type 'DocuSign.eSign.Client.ApiException' occurred in DocuSign.eSign.dll

Additional information: Error calling CreateEnvelope: {
"message": "One or both of Username and Password are invalid."

How can I debug this further?

Answer Source

The Login() API call is used to authenticate against the API and retrieve your baseUrl and accountId. You'll notice that the baseUrl that is returned contains the proper server where your user/account reside.

When you make the Login call against production what value is brought back? Since you are getting a user authentication error I think the value is NOT www but rather eu1 or na2 I'm guessing. Can you confirm which domain is being returned and that you are making production calls against the correct server?

Note: All this info is contained in the POST API Certification guide:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download