docusign 中的 apiClient.RequestJWTUserToken 不起作用 [英] apiClient.RequestJWTUserToken in docusign doesn't work
问题描述
我正在使用 DocuSign C# SDK 创建 JWT 令牌以使用 Integrator 密钥冒充用户,但它抛出一个错误说:
I'm using DocuSign C# SDK to create a JWT token to impersonate as a user using an Integrator key but it throws an error saying:
请求服务器时出错,收到一个不成功的HTTP代码
我只是调用 UpdateToken()
方法,如下所示:
I'm simply calling the UpdateToken()
method which is like this:
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
中传递的所有参数的值是:
values for all the parameters passed in RequestJWTUserToken
are:
"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-----"
}
我已通过使用此端点征得用户同意:
I have taken the consent from the user by using this endpoint:
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
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 密钥具有权限.
and the user has successfully allowed this clientId/integrator key to have the permissions.
我不知道我在这里做错了什么.
I don't know what I am doing wrong here.
推荐答案
对于 Audience
值(代码中的AuthServer
),您需要删除 https://
前缀并将其设置为 account-d.docusign.com
For the Audience
value (AuthServer
in your code), you need to drop the https://
prefix and set that to account-d.docusign.com
这篇关于docusign 中的 apiClient.RequestJWTUserToken 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!