Docusign Python SDK Authentication Example Error: Bad Request

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Docusign Python SDK Authentication Example Error: Bad Request



I am trying to use the Docusign Rest API and attempted to follow the sample code on the Python SDK on Github here: https://github.com/docusign/docusign-python-client. I've replaced the necessary values with those obtained from Docusign (keys, urls etc) but the example seems to break down at the following line:


api_client.configure_jwt_authorization_flow(private_key_filename, oauth_base_url, integrator_key, user_id, 3600)



Before then, the code takes the given information and creates the url to authenticate as I understand it. I've manually accessed this link and it seems to work; it asks me for permission to allow the program to act on my behalf and then redirects me to the redirect uri with a code added to the uri. My problem is that when it executes the next line (the one I posted above), it results in this:


Traceback (most recent call last):

File "<ipython-input-40-84847e506c37>", line 1, in <module>
runfile('C:/Users/santi/Desktop/docusign/untitled0.py', wdir='C:/Users/santi/Desktop/docusign')

File "C:UserssantiAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "C:UserssantiAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/santi/Desktop/docusign/untitled0.py", line 501, in <module>
api_client.configure_jwt_authorization_flow(private_key_filename, oauth_base_url, integrator_key, user_id, 3600)

File "C:UserssantiAnaconda3libsite-packagesdocusign_esignapi_client.py", line 126, in configure_jwt_authorization_flow
post_params=self.sanitize_for_serialization("assertion": assertion, "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer"))

File "C:UserssantiAnaconda3libsite-packagesdocusign_esignapi_client.py", line 430, in request
body=body)

File "C:UserssantiAnaconda3libsite-packagesdocusign_esignrest.py", line 244, in POST
body=body)

File "C:UserssantiAnaconda3libsite-packagesdocusign_esignrest.py", line 200, in request
raise ApiException(http_resp=r)

ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict('Cache-Control': 'private', 'Content-Type': 'text/html', 'X-AspNetMvc-Version': '5.2', 'X-DocuSign-TraceToken': '15fb83c2-9054-4522-b5ed-b77646fe1c4b', 'X-DocuSign-Node': 'DA2DFE4', 'Date': 'Sun, 05 Aug 2018 19:35:12 GMT', 'Content-Length': '11')
HTTP response body: b'Bad Request'



I've googled the problem and found some similar errors on here but none that helped me out much. Following the traceback takes me into the api_client.py and rest.py files but I wasn't able to decipher much. In the end the origin in the error seems to be in line 200 of rest.py where an exception is raised because a value unknown to me is not within the proper range. I'm not sure what is causing the bad request on my end. Has anyone had a similar experience or might know what the issue is? I'd appreciate it a lot, thanks.




1 Answer
1



I was getting exactly the same error at the same line.



The account specific inputs to api_client.configure_jwt_authorization_flow() are:



It turns out that the user_id value should the API Username code. That fixed the problem. I found the answer here:
DocuSign Python SDK - API Exception 400 - 'Bad Request'



Hope it solves your problem too!





Thanks a lot this fixed it perfectly!
– Santiago Erazo
Aug 9 at 5:21






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard