I've reviewed the information provided, and if I understand correctly, the issue is that you're attempting to authenticate with DocuSign but are receiving an unhelpful error message that simply states: "Error while requesting server, received a non-successful HTTP code with response Body: ".
Typically, this type of error would include more specific details. For example, it might say: "Error while requesting server, received a non-successful HTTP code with response Body: {"error":"consent_required"}". In your case, it seems that the actual error message is missing. This is something I’ve seen before, and it often points to some form of network issue.
The problem could potentially be related to a handshake failure with the authentication server. Based on previous cases, here are a few things to check:
a) Ensure that you're passing the correct authServer (aud) value. If you're connecting to a developer account, use: https://account-d.docusign.com. If connecting to a production account, use: account.docusign.com.
b) Verify that the server is using TLS 1.2.
c) Check if you're behind a proxy or firewall, as this can sometimes cause issues.
If you’ve verified the above and are still experiencing the issue, could you provide the exact request using a network trace tool like Fiddler or Wireshark?
Also, could you provide some background on how your code is running? For example, are you using a virtual machine, or is your code running behind a custom-built network with potential restrictions?
Please ensure your request follows this format.
{
"iss": "<your_integration_key>",
"sub": "<your_user_ID>",
"aud": "account-d.docusign.com",
"iat": <current_unix_epoch_time>,
"exp": <current_unix_epoch_time+6000>,
"scope": "signature impersonation"
}
Best,
Dev/API team
Hi!
I’ve the same error.
I’m trying to get a JWT in a C# Console app (no web) for sending enveloppes.
But when calling RequestJWTUserToken I have this response :
Error while requesting server, received a non successful HTTP code with response Body: {"error":"consent_required"}
I call with these datas :
docuSignClient.RequestJWTUserToken(
clientId,
impersonatedUserId,
authServer,
privateKeyBytes,
1,
scopes)
with :
var scopes = new List<string>
{
"signature",
"impersonation",
};
authServer = “account-d.docusign.com”
clientId = integration app ID
impersonatedUserId = User ID
and privateKeyBytes = Encoding.UTF8.GetBytes(Config.RSA_PrivateKey.ToCharArray())
Any idea about my problem ?
@DenisC your problem relies in the fact that in order to communicate with DocuSign you need the user to allow DocuSign to do this on its behalf→ hence, you need to redict the user from your webpage to allowing consent on Docusign and then redirect the user back to your web page.
function redirectToConsentUrl($clientId, $redirectUri, $scope) {
$consentUrl = "https://account-d.docusign.com/oauth/auth?response_type=code&scope=$scope&client_id=$clientId&redirect_uri=$redirectUri";
header('Location: '.$consentUrl);
//echo "Please visit this URL to authorize the application: $consentUrl";
exit;
}