Post Go Live issue with Docusign using node.js

Arn*_*aud 8 node.js docusignapi

Here is my issue:

  • We integrated docusign in our application, server side with nodejs using this tutorial https://github.com/docusign/docusign-node-client ("OAuth JSON Web Token (JWT) Grant" section)
  • We have done the "Go Live Process": our application is registered in our production account
  • We have replaced the test config to the production config.
  • When we try to create an envelope, we get the following error: PARTNER_AUTHENTICATION_FAILED: The specified Integrator Key was not found or is disabled. Invalid account specified for user

What am I doing wrong ?

async function docusignInit() {
    var options;
    var env = [40077,50077].indexOf(config.main.port) != -1 ? 'test' :'prod';
    if (env == "test") {
        options = {
            basePath: restApi.BasePath.DEMO,
            oAuthBasePath: oAuth.BasePath.DEMO
        }
    } else {
        options = {
            oAuthBasePath: "account.docusign.com",
           // We called https://account.docusign.com/oauth/userinfo to found the uri
            basePath:"https://eu.docusign.net/restapi/"
        }
    }
    // in production, We must do
    // var apiClient = new docusign.ApiClient(options.basePath);
    // Otherwise, we get "Error: getaddrinfo ENOTFOUND undefined undefined:443"
    var apiClient = new docusign.ApiClient(options.basePath);
    var privateKeyFile = fs.readFileSync(`./server/docusign/keys/${env}/private.PEM`);
    var res = await apiClient.requestJWTUserToken(config.docusign.integratorKey, config.docusign.userName, [oAuth.Scope.IMPERSONATION, oAuth.Scope.SIGNATURE], privateKeyFile, 3600)
    var token = res.body.access_token;
    apiClient.addDefaultHeader('Authorization', 'Bearer ' + token);
    docusign.Configuration.default.setDefaultApiClient(apiClient);
    await sendDocusign({
        userId: 1,
        firstName: 'foor',
        lastName: 'bar',
        email:'foo@bar;'
    })
}


async function sendDocusign(role) {

    var envDef = new docusign.EnvelopeDefinition();
    envDef.emailSubject = 'Please signe this';
    envDef.templateId = config.docusign.templateId;

    var role = new docusign.TemplateRole();
    role.roleName = "roleName";
    role.clientUserId = role.userId;
    role.name = role.firstName + " " + role.lastName;
    role.email = role.email;

    envDef.allowReassign = false;
    envDef.templateRoles = [role];
    envDef.status = 'sent';

    var envelopesApi = new docusign.EnvelopesApi();
    return await envelopesApi.createEnvelope(config.docusign.userAccountId, {
        'envelopeDefinition': envDef
    })
}
Run Code Online (Sandbox Code Playgroud)

Leg*_*ion 0

考虑到您的错误似乎是您缺少 integratorKey 或者您以错误的方式编写了它。根据该链接,您可能错过了积分器密钥内的括号吗?

\n\n
\n

集成商密钥必须放置在 UsernameToken 的 Username 节点中的用户 ID 前面。积分器密钥必须用方括号 \n\n \xe2\x80\x9c[ 和 ]\xe2\x80\x9d 括起来。

\n
\n\n

上述文档中的 api 示例:

\n\n
<soap:Header>\n   <wsa:Action>http://www.docusign.net/API/3.0/GetRecipientEsignList</wsa:Action>\n   <wsa:MessageID>uuid:3f9d7626-c088-43b4-b579-2bd5e8026b17</wsa:MessageID>\n   <wsa:ReplyTo>\n      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>\n   </wsa:ReplyTo>\n   <wsa:To>http://demo.docusign.net/api/3.0/api.asmx</wsa:To>\n   <wsse:Security soap:mustUnderstand="1">\n      <wsu:Timestamp wsu:Id="Timestamp-8838aa24-9759-4f85-8bf2-26539e14f750">\n         <wsu:Created>2006-04-14T14:29:23Z</wsu:Created>\n         <wsu:Expires>2006-04-14T14:34:23Z</wsu:Expires>\n      </wsu:Timestamp>\n      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-7c7b695e-cef7-463b-b05a-9e133ea43c41">\n         <wsse:Username>[Integrator Key Here]2988541c-4ec7-4245-b520-f2d324062ca3</wsse:Username>\n         <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>\n         <wsse:Nonce>SjlScsL5q3cC1CDWrcMx3A==</wsse:Nonce>\n         <wsu:Created>2006-04-14T14:29:23Z</wsu:Created>\n      </wsse:UsernameToken>\n   </wsse:Security>\n</soap:Header>\n
Run Code Online (Sandbox Code Playgroud)\n