【问题标题】:Docusign legacy header error when making api call进行 api 调用时,Docusign 遗留标头错误
【发布时间】:2017-08-25 01:24:49
【问题描述】:

我在尝试为 Docusign API 使用旧标头时收到错误消息。

这是我的代码

request({
    headers: {
        "X-DocuSign-Authentication": [{
            "Username": "zabie@toplevelstaging.com",
            "Password": "xxxxxxxx",
            "IntegratorKey": "xxxxxxxxxxx-11xxx2f567xxxx0dbxxxx2d"
        }]
    },
    url: "https://demo.docusign.net/restapi/v2/accounts/3465212/envelopes",
    json: true, // <--Very important!!!
    body: data,
    method: "POST",

}, function (error, response, body) {
    console.log(response.body);
});
console.log(data[0].templateRoles[0].tabs.textTabs[0].value);
console.log(data[0].templateRoles[0].roleName);
res.redirect('/contracts');

});

这是错误

{
    errorCode: 'INVALID_TOKEN_FORMAT',
    message: 'The security token format does not conform to expected schema.'
}

【问题讨论】:

    标签: node.js api authentication docusignapi


    【解决方案1】:

    您传递的 authheader 不正确。请尝试以下操作。 SDK文档here

    // create JSON formatted auth header
    var creds = JSON.stringify({
      Username: "zabie@toplevelstaging.com",
      Password: "xxxxxxx",
      IntegratorKey: "xxxxxxxxxxx-11xxx2f567xxxx0dbxxxx2d"
    });
    
    
    request({
       headers: { "X-DocuSign-Authentication": creds },
       url: "https://demo.docusign.net/restapi/v2/accounts/3465212/envelopes",
       json: true, // <--Very important!!!
       body: data,
       method: "POST",
       }, function (error, response, body) {
        console.log(response.body);
    });
    

    【讨论】:

      猜你喜欢
      • 2015-11-30
      • 2018-02-15
      • 1970-01-01
      • 2020-07-20
      • 1970-01-01
      • 1970-01-01
      • 2020-05-03
      • 2021-12-01
      • 1970-01-01
      相关资源
      最近更新 更多