1
votes

I am using docusign for digital signature , where I have to create a jwt token. For this I have been using code from git repo https://github.com/docusign/docusign-python-client.

docusign version 3.1.0 , python version 3.5 and 3.6 in sandbox mode . getting following error raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url http://account-d.docusign.com/oauth/token (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))

i have followed the curl request using following url JSON Web Token (JWT) Grant

got an application token and while passing in auth giving me 401(401 UNAUTHORIZED ) error postman

claim = {"iss": '4556e2f7-4a3d-41f9-a0c3-18535a28ab2a', "aud": 'account-d.docusign.com', "iat": now, "exp": later, "scope": " ".join(scopes)} token = jwt.encode(payload=claim, key=pkey, algorithm='RS256').decode("utf-8") i getting application token using above code but when i pass all the required parameter i got {"error":"invalid_grant","error_description":"no_valid_keys_or_signatures"} but when i pasted my jwt token in jwt.io with my public and privte key its says signature verified.

I have added the links of screenshots, that might also help to understand more about the problem. https://ibb.co/2yKXNCW https://ibb.co/cFTk6R1 https://ibb.co/t3YMkr2

1

1 Answers

0
votes

Here are the things that you must ensure:

  1. You have an Integration key (clientID) that is configured correctly.

  2. You have an RSA Private key. that key was copied/pasted exactly as given to your configuration file. New lines must be preserved

  3. Your URLs are matching the environment. Meaning you use account-d and demo.docusign.net for the sandbox env endpoints.

  4. You need the userId which is a GUid for the user that would be impersonated. That user must consent to the application. You have to ensure you pass userId and not accountId and that it is for the same account that you would be using.

If you confirm all of this and still get an error - I would consider to use our code example to start. I don't see code in your question, but our code example should be a good way to start.