Thiwanka Wickramage
Thiwanka Wickramage

Reputation: 892

Why getting error when request docusign JWT token

I need to get JWT token from Docusign and send email to get signature.

I used docusign provided repo code sample and it doesn't work. github link https://github.com/docusign/eg-01-node-jwt

await dsApi.requestJWTUserToken(dsConfig.clientId,
      dsConfig.impersonatedUserGuid, scopes, dsConfig.privateKey,
      jwtLifeSec)

error > Error: error:0908F070:PEM routines:get_header_and_data:short header

what I missed get to work this project.

Upvotes: 1

Views: 3222

Answers (3)

imrok
imrok

Reputation: 837

I solved this problem by removing extra spaces on every line starts, after each new line characters.

By default, my IDE was adding two spaces for identation at the begining of every line.

  privateKey: `-----BEGIN RSA PRIVATE KEY-----
  MIIEpAIBAAKCAQEA8um2ZIdO5UdLBBJ6vKORodORRz6+TI+5JpJRFszojzZAwHgF
^^

The javascript `` template syntax is considering every characters from the line start.

Upvotes: 7

Thiwanka Wickramage
Thiwanka Wickramage

Reputation: 892

I found the solution. I created separate .pem file and put the secret key. Then read file form the code. Its worked for me.

Upvotes: 0

Inbar Gazit
Inbar Gazit

Reputation: 14005

Please make sure the following: 1. You generated Integration Key in the Sandbox environment 2. You have stored your private RSA Key and it's properly formed. 3. The urls you use are for Sandbox not production (demo or -d)

The error above is misleading/confusing but something is wrong with the authentication call, often it's the key that's bad.

Upvotes: 0

Related Questions