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


I am trying to send envelope using docuSign, but having error while get authorization_code which need to get access_Token.

Please help me to get authorization_Code and access_Token.

I am using ASP.Net web forms and .NET framework 4.5.2

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


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;


Please make sure that the specified redirect URI is configured under the redirect URI section for the integration key that is being used. Please keep in mind that the same exact redirect URI has to be used when using your authentication URL.

The specified section is found under Settings > Apps and Keys > Click on your integration key > Edit

I would also recommend creating a new integration key, since you have shared it publicly on this thread.

Answered By – Gloriana Marin

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *