Well I have gone through a lot of questions, and their respective answers, mostly instead of private key (which starts from -----BEGIN RSA PRIVATE KEY-----) to encode in jwt, public key was being sent (which does not begin from -----BEGIN RSA PRIVATE KEY-----). I have used pyjwt library in python to encode and get the required token which I am using to send to docusign for authorization purpose. well this is what i have tried and won't work
payload = {
"iss": CLIENT_AUTH_ID,
"sub": ACCOUNT_ID,
"exp": unix,
"aud": "account-d.docusign.com",
"scope": "signature impersonation"
}
signed = jwt.encode(payload, private_key, algorithm='RS256')
It always return with ValueError: cannot deserialize the data, their HS256 algorithm works properly fine, but when it comes to RS256 it won't, some answer suggested to convert it to PEM format but mine is already in that format (-----BEGIN RSA PRIVATE KEY----- (code) -----END RSA PRIVATE KEY-----)