docusign-esign-csharp-client icon indicating copy to clipboard operation
docusign-esign-csharp-client copied to clipboard

Error while requesting server, received a non successful HTTP code with response Body: {"error":"consent_required"}

Open Tushar5283 opened this issue 3 years ago • 1 comments

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;

Tushar5283 avatar Mar 15 '22 20:03 Tushar5283

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.

karankaushik95 avatar Mar 16 '22 21:03 karankaushik95