pradman pradman - 3 months ago 103
C# Question

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

I am using the docusign C# client (https://github.com/docusign/docusign-csharp-client).


  1. The same code works in the staging (demo.docusign.net) environment, but fails in the production (www.docusign.net) 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: {
"errorCode": "USER_AUTHENTICATION_FAILED",
"message": "One or both of Username and Password are invalid."
}


How can I debug this further?

Answer

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: https://www.docusign.com/sites/default/files/API_Certification_Post_04_08_16.pdf

Comments