docusign-esign-csharp-client
docusign-esign-csharp-client copied to clipboard
Error while requesting server, received a non successful HTTP code with response Body: {"error":"consent_required"}
I am following below code and getting the consent required error. Please suggest the solution,
var apiClient = new ApiClient("https://demo.docusign.net/restapi");
string ik = "xxxxxxxxxxxxxxxxxxxxxxx";
string userId = "xxxxxxxxxxxxxxxx";
string authServer = "account-d.docusign.com";
string rsaKey = File.ReadAllText(@"C:\WorkArea\DocuSignProj\DocuSignProj\Doc\pass.txt");
List<string> scopes = new List<string>
{
"impersonation"
};
OAuth.OAuthToken authToken = apiClient.RequestJWTUserToken(ik, userId, authServer, Encoding.UTF8.GetBytes(rsaKey), 1, scopes);
string accessToken = authToken.access_token;
Have you granted consent to your app before requesting the auth token? JWT requires the user to grant consent once per app based on the Integration Key. Step 1 of this guide describes how to grant consent for your app.