DocuSign JWT Auth 请求服务器时出错,收到带有响应正文的不成功 HTTP 代码

问题描述 投票:0回答:1

我正在尝试将 DocuSign 集成到我的 Web 应用程序(.net Framework 4.8)中。我正在使用 DocuSign eSign dll 版本 6.5.0。

我正在尝试使用 JWT 身份验证授权来获取访问令牌。我在 DocuSign 开发人员门户中创建了应用程序和集成密钥,并已授予同意。

但是,当我尝试获取访问令牌时,它会抛出 ApiException 并显示消息: 请求服务器时出错,收到带有响应正文的不成功 HTTP 代码:

    getAuthInfo(out string clientID, out string rsaPrivateKey, out string impersonatedUserID);

    var docuSignClient = new DocuSignClient();

    var scopes = new List<string>{"signature","impersonation"};

    var privateKeyBytes = Encoding.ASCII.GetBytes(rsaPrivateKey);

    try
    {
        var authToken = docuSignClient.RequestJWTUserToken(
                            clientID,
                            impersonatedUserID,
                            "account-d.docusign.com",
                            privateKeyBytes,
                            1,
                            scopes);
                            
        return authToken;               
    }
    catch (ApiException apiExp)
    {
        // Consent for impersonation must be obtained to use JWT Grant
        if (apiExp.Message.Contains("consent_required"))
        {
            
        }
    }
c# asp.net docusignapi
1个回答
0
投票

如果您查看错误和实际响应正文,它将提供更多信息,我们可以为您提供帮助。

© www.soinside.com 2019 - 2024. All rights reserved.