如何获取 Authorization_code 和 access_Token 并使用 asp.net 发送信封 DocuSign

How to get Authorization_code and access_Token and send envelope DocuSign using asp.net

我正在尝试使用 docuSign 发送信封,但在获取需要获取 access_Token.

authorization_code 时出错

请帮我得到authorization_Codeaccess_Token

我正在使用 ASP.Net 网络表单和 .NET Framework 4.5.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;
}

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

指定部分可在“设置”>“应用程序和密钥”下找到 > 单击您的集成密钥>“编辑”

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