How to use the docusign-esign.AuthenticationApi function in docusign-esign

To help you get started, we’ve selected a few docusign-esign examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github docusign / docusign-node-client / test / Recipes / CoreRecipes.js View on Github external
// initialize the api client
  var apiClient = new docusign.ApiClient();
  apiClient.setBasePath(BaseUrl);

  // create JSON formatted auth header
  var creds = '{"Username":"' + UserName + '","Password":"' + Password + '","IntegratorKey":"' + IntegratorKey + '"}';
  apiClient.addDefaultHeader('X-DocuSign-Authentication', creds);

  // assign api client to the Configuration object
  docusign.Configuration.default.setDefaultApiClient(apiClient);

  // ===============================================================================
  // Step 1:  Login() API
  // ===============================================================================
  // login call available off the AuthenticationApi
  var authApi = new docusign.AuthenticationApi();

  // login has some optional parameters we can set
  var loginOps = new authApi.LoginOptions();
  loginOps.setApiPassword('true');
  loginOps.setIncludeAccountIdGuid('true');
  authApi.login(loginOps, function (error, loginInfo, response) {
    if (error) {
      console.log('Error: ' + error);
      return;
    }

    if (loginInfo) {
      // list of user account(s)
      // note that a given user may be a member of multiple accounts
      var loginAccounts = loginInfo.getLoginAccounts();
      console.log('LoginInformation: ' + JSON.stringify(loginAccounts));