48
Views
8
Comments
Solved
[DocuSign 2.1 APIs]  error : invalid_request
docusign2-1apis
Service icon
Forge asset by Robert Adams
Application Type
Service
Service Studio Version
11.54.10 (Build 62419)

I have configured the API as per given steps and given appconsent.

But after all when i tried it is giving error as mentioned in screenshot.

Can anyone help me on this ?

2024-09-04 05-41-42
Pratap Singh Naruka
Solution

Hey Folks,

I have resolved the issue using following approach: 

1.As Issue produced was in createJWT where CreateSignedAsymmetricTokenWithPemKey was not returing Token due to Private key accessiblity.
2.So I have used two commands to generate keys again as per suggested in JWT demo documemtation - 

1. openssl genpkey -algorithm RSA -out rsa_private.pem -pkeyopt rsa_keygen_bits:2048
2. openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem



Then i have fed generated keys in  API configurations and it worked and generated Token.

FYI- These keys generated are not using password phrase.


Cheers 





UserImage.jpg
Tomasz M Lipinski

Hi,

It is 2 years later but the problem remains the same. I've used suggested commands. DocusignConfigurator refused using no password so I've completed  the "openssl genpkey" command with "-aes256" parameter and supplied the password interactively. Then I've replaced the .pem files in DocusignConfigurator. Still no success, still the same "Unexpected error while signing the token". 

The header of the private key file is "BEGIN ENCRYPTED PRIVATE KEY". I've tried "BEGIN RSA PRIVATE KEY" and "BEGIN PRIVATE KEY" (appropriately changing the footer, of course). No success.

I've also checked that the files are UTF-8 encoded.

Has anybody any idea?

Regards

Tomasz

UserImage.jpg
Tomasz M Lipinski

Hi,

After  the newest JWT library is installed the issue is gone. 

Regards

Tomasz

2022-03-19 07-12-06
Alec Manabat

Hi @Pratap Singh Naruka,

Have you checked if the request body you sent is correct? method, headers, auths, etc.. 


Cheers,

Alec

2024-09-04 05-41-42
Pratap Singh Naruka

when I debugged i found error -
"Unexpected error while signing the token: Unable to open private key. Validate if private key in PEM format and password is correct."

2024-09-04 05-41-42
Pratap Singh Naruka

Hi @Alec Manabat
As I found it was not problem with request but with opening private key to generate Token.

FYI- Here in action CreateSignedAsymmetricTokenWithPemKey  accepts Private key in PKCS#8 or PKCS#5 PEM standard format.
I am not sure what can be the reason for this:
"Unexpected error while signing the token: Unable to open private key. Validate if private key in PEM format and password is correct."

Thanks

2024-09-04 05-41-42
Pratap Singh Naruka

Tried these options and solutions 
didn't work for me

2024-09-04 05-41-42
Pratap Singh Naruka
Solution

Hey Folks,

I have resolved the issue using following approach: 

1.As Issue produced was in createJWT where CreateSignedAsymmetricTokenWithPemKey was not returing Token due to Private key accessiblity.
2.So I have used two commands to generate keys again as per suggested in JWT demo documemtation - 

1. openssl genpkey -algorithm RSA -out rsa_private.pem -pkeyopt rsa_keygen_bits:2048
2. openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem



Then i have fed generated keys in  API configurations and it worked and generated Token.

FYI- These keys generated are not using password phrase.


Cheers 





UserImage.jpg
Tomasz M Lipinski

Hi,

It is 2 years later but the problem remains the same. I've used suggested commands. DocusignConfigurator refused using no password so I've completed  the "openssl genpkey" command with "-aes256" parameter and supplied the password interactively. Then I've replaced the .pem files in DocusignConfigurator. Still no success, still the same "Unexpected error while signing the token". 

The header of the private key file is "BEGIN ENCRYPTED PRIVATE KEY". I've tried "BEGIN RSA PRIVATE KEY" and "BEGIN PRIVATE KEY" (appropriately changing the footer, of course). No success.

I've also checked that the files are UTF-8 encoded.

Has anybody any idea?

Regards

Tomasz

UserImage.jpg
Tomasz M Lipinski

Hi,

After  the newest JWT library is installed the issue is gone. 

Regards

Tomasz

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.