【问题标题】:How to get Authorization_code and access_Token and send envelope DocuSign using asp.net如何使用 asp.net 获取 Authorization_code 和 access_Token 并发送信封 DocuSign
【发布时间】:2021-03-31 10:31:26
【问题描述】:

我正在尝试使用 docuSign 发送信封,但在获取需要获取 access_Tokenauthorization_code 时出错。

请帮我获取authorization_Codeaccess_Token

我正在使用 ASP.Net 网络表单和 .NET 框架 4.5.2

  • DocuSign.eSign.dll 5.2.0
  • DocuSign.Integration.Client.dll 1.7.2

请求: https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature&client_id=4f464e25-6425-4ea6-915b-aa9bac5b8ce7&redirect_uri=https://account-d.docusign.com/ds/login?authType=JWT

回应: The redirect redirect_uri is not registered properly with DocuSign

string RedirectURI = "https://account-d.docusign.com/ds/login?authType=JWT";
string ClientSecret = "****";
string IntegratorKey = "****";


 Uri oauthLoginUrl = GetAuthorizationUri(IntegratorKey, scopes, RedirectURI, OAuth.CODE, null);    
 WebRequest request = WebRequest.Create(oauthLoginUrl);
 WebResponse response = request.GetResponse();

public Uri GetAuthorizationUri(string clientId, List<string> scopes, string redirectUri, string responseType, string state = null)
{
    string formattedScopes = (scopes == null || scopes.Count < 1) ? "" : scopes[0];
    StringBuilder scopesSb = new StringBuilder(formattedScopes);
    for (int i = 1; i < scopes.Count; i++)
    {
        scopesSb.Append("%20" + scopes[i]);
    }

    UriBuilder builder = new UriBuilder("https://account-d.docusign.com")
    {
        Scheme = "https",
        Path = "/oauth/auth",
        Port = 443,
        Query = BuildQueryString(clientId, scopesSb.ToString(), redirectUri, responseType, state)
    };
    return builder.Uri;
}

【问题讨论】:

    标签: asp.net webforms docusignapi access-token


    【解决方案1】:

    请确保在正在使用的集成密钥的重定向 URI 部分下配置了指定的重定向 URI。请记住,在使用您的身份验证 URL 时,必须使用完全相同的重定向 URI。

    指定部分位于设置 > 应用程序和密钥 > 单击您的集成密钥 > 编辑

    我还建议您创建一个新的集成密钥,因为您已在此线程上公开共享它。

    【讨论】:

    • 谢谢 Gloriana Marin ...实际上这个问题已经解决了。但是如何从响应中查找代码值或从哪里获取需要获取 accessToken 的代码值。 GenerateAccessToken(IntegratorKey,ClientSecret,代码)。
    • 嗨交换,这将是您在请求授权码时从回调中收到的授权码。这可以在本文档的第一步中找到 第 1 步。请求授权码:developers.docusign.com/platform/auth/authcode/…
    • 谢谢 Gloriana Marin,我参考了本文档并生成了上述请求,但没有得到本文档中提到的响应。所以我无法获得价值代码。你能告诉我我在哪里可以找到代码的价值吗?或者它在哪里?
    • 嗨交换,为了进一步帮助解决这个问题,请在 support.docusign.com 上打开一个案例
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多