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

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

Open Vetsoftone opened this issue 4 years ago • 5 comments

I tried to receive a token with the code below. Unfortunatelly I get the error:

DocuSign.eSign.Client.ApiException
  HResult=0x80131500
  Nachricht = Error while requesting server, received a non successful HTTP code with response Body: {"error":"consent_required"}

I tried with set TLS 12 and without. We run it in dev mode with base path https://demo.docusign.net/restapi and oAuthBasePath =account-d.docusign.com

Anyone konws what is wrong?

  byte[] privateKey=DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(privateKeyFilename));
            var scopes = new List<string>
                {
                    "signature",
                    "impersonation",
                };
            var basePath = ApiClient.Production_REST_BasePath;
            var oAuthBasePath = OAuth.Production_OAuth_BasePath;
            if (!production)
            {
                basePath = ApiClient.Demo_REST_BasePath;
                oAuthBasePath = OAuth.Demo_OAuth_BasePath;
            }

            
            var _apiClient = new ApiClient(basePath);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var authToken = _apiClient.RequestJWTUserToken(
            clientId,
            ImpersonatedUserId,
            oAuthBasePath,
            privateKey,
            1,
            scopes);

Vetsoftone avatar Aug 30 '21 15:08 Vetsoftone

I tried to set the consens manually with the URL below. But I receive the (Login Window) the error invalid Authorization: RequestType is not supported.

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=a5ed47d5-xxxx-xxxx-8a19-756da64391de&redirect_uri=https://www.docusign.com

Is the something wrong with my account Setting?

Vetsoftone avatar Aug 30 '21 20:08 Vetsoftone

I found the solution. instead of reponse_type= code I have to use token

Vetsoftone avatar Aug 30 '21 21:08 Vetsoftone

The real issue is that you have the client id (integration key) set to Implicit grant. That is not safe from an information security point of view.

Change the client id to NOT use implicit grant. Then the individual consent API can use response_type=code

LarryKlugerDS avatar Aug 31 '21 11:08 LarryKlugerDS

We choose Implicit grant we have a SPA App. I read this article.https://developers.docusign.com/platform/auth/. Is Implicit grant not correct for SPA Apps?

Vetsoftone avatar Sep 01 '21 11:09 Vetsoftone

Is this issue still relevant?

InbarGazit avatar May 17 '23 22:05 InbarGazit