DocuSign REST API .Net framework SDK - How to correctly generate token (error: issuer_not_found)

DocuSign REST API .Net framework SDK - How to correctly generate token (error: issuer_not_found)

我正在尝试为隐式授权生成令牌。

示例调用代码:

public static string GetAccessToken()
        {
            string accessToken = "";

            try
            {
                ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");

                string integrationKey = "75fe59b8-b2f6-499d-89bb-da9d0f1ee4ea";
                string userId = "7c36c435-d8eb-4b71-b46c-a4d4b20b06e1";// Impersonated User GUID

                string sPrivatekey = File.ReadAllText(@"c:\Temp\DocuTest2\key.pem");

                byte[] privatekey = System.Text.Encoding.UTF8.GetBytes(sPrivatekey);

                List<string> scopes = new List<string>() { OAuth.Scope_SIGNATURE }; // OAuth.Scope_IMPERSONATION

                var token = apiClient.RequestJWTUserToken(integrationKey, userId, OAuth.Demo_OAuth_BasePath, privatekey, 1000, scopes);

                return accessToken;
            }
            catch (Exception e)
            {
                return accessToken;
            }
        }

有错误: “请求服务器时出错,收到不成功的 HTTP 代码已完成响应正文:{“错误”:“invalid_grant”,“error_description”:“issuer_not_found”}“

如何正确调用这个函数?怎么了?

非常感谢!

更新:您好,我需要从没有网络的 .net 框架 sdk 生成令牌 - 隐式授权。对于接下来从 Delphi.

调用的我的库项目 (DLL)

您还需要 JWT 的“模拟”作用域。

List<string> scopes = new List<string>() { OAuth.Scope_SIGNATURE }; // OAuth.Scope_IMPERSONATION

不知道为什么它被注释掉了,但这不适用于模拟。

错误消息指的是 Issuer 参数。那就是 ISS 声明,即 client_id(集成密钥)。所以检查它是否正确。

同时检查 aud 设置是否为 account-d。docusign.com 而不是 https://account-d.docusign.com

如果您在生产环境中使用此应用,请使用帐户。docusign.com但您必须先完成 go-live 过程。

你的范围没问题。 impersonation 范围由 JWT 授权流程假定(但可以选择包含)。 impersonationsignature 范围都必须在同意过程中请求。

此外,您的示例使用的是 JWT 授权,而不是隐式授权。隐式授权流程是完全不同的鱼缸,SDK 未实现。相反,您的应用会实现它。

我们的场景的解决方案是调用这个..

public static void CallAuthorizationURLforConsent(字符串 clientId,字符串 basePath,字符串 redirectUrl) { ApiClient apiClient = new ApiClient(basePath);

            List<string> scopes = new List<string>() { OAuth.Scope_SIGNATURE, OAuth.Scope_IMPERSONATION, OAuth.Scope_EXTENDED };

            Uri uri = apiClient.GetAuthorizationUri(clientId, scopes, redirectUrl, OAuth.CODE, null);

            //Open browser and accept consent
            Process.Start(uri.ToString());

            return;         

}