The docs https://docs.docusign.com/esign/guide/authentication/legacy_auth.html do not work. I\'ve spent at least 2 hours trying to get these instructions to work. Either your
The DocuSign live production system has multiple account sub-domains as opposed to the demo system which only uses demo
. For instance, in production the possible sites are www
, na2
, na3
, eu
.
Your integration code needs to parse the sub-domain of the baseUrl
that is returned from your authentication request and re-configure the apiClient
with that new sub-domain.
It looks like you are using a DocuSign SDK, there's a note in the readme that explains this:
Authentication
Service Integrations that use Legacy Header Authentication
(Legacy Header Authentication uses the X-DocuSign-Authentication header.)
Use the Authentication: login method to retrieve the account number and the baseUrl for the account. The url for the login method is www.docusign.net for production and demo.docusign.net for the developer sandbox. The baseUrl field is part of the loginAccount object. See the docs and the loginAccount object
The baseUrl for the selected account, in production, will start with na1, na2, na3, eu1, or something else. Use the baseUrl that is returned to create the basePath (see the next step.) Use the basePath for all of your subsequent API calls.
As returned by login method, the baseUrl includes the API version and account id. Split the string to obtain the basePath, just the server name and api name. Eg, you will receive https://na1.docusign.net/restapi/v2/accounts/123123123. You want just https://na1.docusign.net/restapi Instantiate the SDK using the basePath. Eg ApiClient apiClient = new ApiClient(basePath);
Set the authentication header as shown in the examples by using Configuration.Default.AddDefaultHeader
Reference: C# SDK
Code Sample
Here is the corresponding C# code to do exactly what is mentioned above (ie strip the sub-domain of the baseUrl and re-configure the apiClient):
// Update ApiClient with the new base url from login call
string[] separatingStrings = { "/v2" };
apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl.Split(separatingStrings, StringSplitOptions.RemoveEmptyEntries)[0]);