我正在使用DocuSign C#SDK创建一个JWT令牌,以使用Integrator密钥模拟为用户,但是会抛出错误:
Error while requesting server, received a non-successful HTTP code
我只是在调用UpdateToken()
方法,如下所示:
private static void UpdateToken()
{
var apiClient = new ApiClient();
OAuth.OAuthToken authToken = apiClient.RequestJWTUserToken(ClientID, ImpersonatedUserGuid, AuthServer, Encoding.ASCII.GetBytes(PrivateKey), TokenExpiryInHours, new List<string> { "signature", "impersonation" });
AccessToken = authToken.access_token;
TokenExpiryTime = DateTime.Now.AddSeconds(authToken.expires_in.Value);
}
在RequestJWTUserToken
中传递的所有参数的值为:
"DocuSign": {
"ClientID": "aff67220-XXXX-XXXX-XXXX-426b6575c3bd",
"ImpersonatedUserGuid": "f9a0f822-XXXX-XXXX-XXXX-7a576f06df81",
"AuthServer": "https://account-d.docusign.com",
"TokenReplacementTimeInSeconds": "600",
"TokenExpiryInHours": "1",
"PrivateKey": "-----BEGIN RSA PRIVATE KEY-----\r\XXXXXXX\r\n-----END RSA PRIVATE KEY-----"
}
我已经通过使用此端点征得了用户的同意:
https://account-d.docusign.com/oauth/auth? response_type = token&scope = signature%20impersonation&client_id = aff67220-3ca7-4de7-8556-426b6575c3bd &redirect_uri = https://www.vava.cars/tr/admin
并且用户已成功允许此clientId / integrator密钥具有权限。
我不知道我在做什么错。
答案 0 :(得分:1)
对于Audience
值(代码中的AuthServer
),您需要删除https://
前缀并将其设置为account-d.docusign.com