未找到或禁用指定的Integrator Key。未指定Integrator密钥

时间:2016-12-14 22:54:47

标签: json ajax docusignapi twitter-rest-api

嗨,有人可以请帮忙。请问以下是错误: 的错误 “未找到或禁用指定的Integrator密钥。未指定Integrator密钥。” JSOn请求:

var creds = JSON.stringify({
Username: "suresh.rajput@spark.co.nz",
Password: "winter18",
IntegratorKey: "a51e3ce6-4ea9-4f3d-9287-6cebe8231849"
});
var pObj = new Object();
var cObj = new Object();
cObj.documentBase64 = "WzEwLzYvMTU";
cObj.documentId = "1234";
cObj.fileExtension = ".xml";
cObj.name = "SUresh";
cObj.order= "qeqeqeq";
pObj.documents = cObj;
pObj.emailSubject ="Suresh";
                $.ajax({

                     url: 'https://demo.docusign.net/restapi/v2/accounts/2071095/envelopes',
                     beforeSend: function (request)
                    {
                        /*ApiClient apiClient = new ApiClient("https://apiexplorer.docusign.com");
                        Configuration cfi = new Configuration(apiClient);
                        cfi.AddDefaultHeader("X-DocuSign-Authentication", creds);
                        AuthenticationApi authApi = new AuthenticationApi(cfi);*/
                        request.setRequestHeader("Accept", "application/json");
                        request.setRequestHeader("Accept-Encoding","gzip,deflate,sdch");
                        request.setRequestHeader("Accept-Language","en-US,en;q=0.8,fa;q=0.6,sv;q=0.4");
                        request.setRequestHeader("Origin","https://apiexplorer.docusign.com");
                        request.setRequestHeader("Referer","https://apiexplorer.docusign.com/");
                        request.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0");
                        request.setRequestHeader("Authorization", "bearer 29Diokb4VuiEA/W/F/FTyywW1f4=");
                        request.setRequestHeader("Content-Type", "application/json");
                        request.setRequestHeader("X-DocuSign-Authentication", creds);

                    },
                     method: 'POST',
                     dataType: 'jsonp',
                     crossDomain: true,
                     data: JSON.stringify(pObj),
                     success: function(msg){
                       console.log('success: '+msg);
                     },
                     error: function(msg){
                           //console.log(msg);
                     }
                  });

2 个答案:

答案 0 :(得分:1)

您的代码

var creds = JSON.stringify({
    Username: "suresh.rajput@spark.co.nz",
    Password: "winter18",
    IntegratorKey: "a51e3ce6-4ea9-4f3d-9287-6cebe8231849"
});

...

request.setRequestHeader("X-DocuSign-Authentication", creds);

看起来很好。

但您也通过以下方式发送OAuth身份验证凭据:

request.setRequestHeader("Authorization", "bearer 29Diokb4VuiEA/W/F/FTyywW1f4=");

这就是问题所在。可以使用X-DocuSign-Authentication进行身份验证,也可以使用Authorization进行OAuth身份验证,但不能同时使用两者。

已添加

此外,不需要这些标题:

request.setRequestHeader("Origin","https://apiexplorer.docusign.com");
request.setRequestHeader("Referer","https://apiexplorer.docusign.com/");
request.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0");

我不确定你为什么要添加这些:

request.setRequestHeader("Accept-Encoding","gzip,deflate,sdch");
request.setRequestHeader("Accept-Language","en-US,en;q=0.8,fa;q=0.6,sv;q=0.4");

答案 1 :(得分:0)

  • “X-DocuSign-Authentication”的示例键/值示例如下:

    “X-DocuSign-Authentication”:{“用户名”:“myemail@domain.com”,“密码”:“pwdhere”,“IntegratorKey”:“已删除”}

请确保格式符合相应的双引号。

  • 请注意,您需要获得新的集成商密钥。 IK永远不应公开分享。