Getting Consent For A Console Application

Viewed 171

I am trying to create a console program that gets all of the Envelope EmailSubject's from the last day.

I am having trouble with consent and I keep getting the error:

DocuSign.eSign.Client.ApiException: 'Error while requesting server, received a non successful HTTP code Completed with response Body: {"error":"consent_required"}'

I get this message after running the following code:

var apiClient = new ApiClient();
        string ik = _configuration.IntegrationKey;
        string userId = _configuration.UserId;
        string authServer = _configuration.AuthServer;
        string rsaKey = DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(_configuration.PrivateKeyFile));
        OAuth.OAuthToken authToken = apiClient.RequestJWTUserToken(ik,
                        userId,
                        authServer,
                        Encoding.UTF8.GetBytes(rsaKey),
                        1);

I understand that I need to "Grant consent to an internal application" using the DocuSign Admin portal steps found here: How to obtain admin consent for internal applications/

However, even after adding my application to the connected app list, I am still getting the "{"error":"consent_required"}" error.

Any help would be greatly appreciated!

1 Answers

Consent is needed only once, ever, per a specific integration and a user. Since you have only one user, you just need to do this once and you're good.

Open a browser to this URL after you add https://www.docusign.com as a valid redirect in the Apps and Keys page for your IK:

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=<YOUR_IK>&redirect_uri=https://www.docusign.com

(update your IK)

Related