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