gpt4 book ai didi

c# - Docusign 指定的集成商 key 未找到或已禁用

转载 作者:太空宇宙 更新时间:2023-11-03 19:52:54 25 4
gpt4 key购买 nike

我正在尝试以下代码 as mentioned here ,

public string loginApi(string usr, string pwd)
{
// we set the api client in global config when we configured the client
ApiClient apiClient = Configuration.Default.ApiClient;
string authHeader = "{\"Username\":\"" + usr + "\", \"Password\":\"" + pwd + "\", \"IntegratorKey\":\"" + INTEGRATOR_KEY + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);

// we will retrieve this from the login() results
string accountId = null;

// the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object
AuthenticationApi authApi = new AuthenticationApi();
LoginInformation loginInfo = authApi.Login();

// find the default account for this user
foreach (LoginAccount loginAcct in loginInfo.LoginAccounts)
{
if (loginAcct.IsDefault == "true")
{
accountId = loginAcct.AccountId;
break;
}
}
if (accountId == null)
{ // if no default found set to first account
accountId = loginInfo.LoginAccounts[0].AccountId;
}
return accountId;
}

它不工作,我用 try catch 包裹它并注意到这个错误,

Error calling Login: {

"errorCode": "PARTNER_AUTHENTICATION_FAILED",

"message": "The specified Integrator Key was not found or is disabled."

}

当我看着 fiddler 时,

enter image description here

请求将发送到 www.docusign.net,我想将其发送到 https://demo.docusign.net。如何更改此代码的 Base Uri?

最佳答案

好的,问题解决了。错误信息具有误导性。

第 1 步 - 似乎我需要构建配置对象。

 ApiClient client = new ApiClient(basePath:  "https://demo.docusign.net/restapi");
Configuration cfg = new Configuration(client);

第 2 步 - 需要设置 auth header

cfg.AddDefaultHeader("X-DocuSign-Authentication", authHeader);

第三步传递给Api的构造函数

 AuthenticationApi authApi = new AuthenticationApi(cfg);

关于c# - Docusign 指定的集成商 key 未找到或已禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36561392/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com