简体   繁体   English

文件认证和服务认证:无效请求

[英]Docusign and service Authentication : invalid request

I am trying to use service authentication mechanism for logging in. But getting an invalid request.I have created the JWT using node jsonwebtoken package.below is the error I am getting. 我正在尝试使用服务身份验证机制进行登录。但是收到无效请求。我已使用节点jsonwebtoken包创建了JWT。以下是我得到的错误。

Copying the JWt creation logic 复制JWt创建逻辑

var jwt = require('jsonwebtoken');

var fs = require('fs');

//creating the payload for docusign

var payload = {
  "iss": "cb91877d-1d55-48ae-88d7-fd215c4fe2ca",
  "sub": "6cd4ea4e-3e68-4994-88b1-a321847cbf7e",
  "iat": 1508868716,
  "exp": 1508869916,
  "aud": "account-d.docusign.com",
  "scope": "signature",
    "nbf":1508868716, 
 "name": "neeush"
}

var cert = fs.readFileSync('private.pem');  // get private key

var token = jwt.sign(payload, cert, { algorithm: 'RS256'});

Can you find any issues in the same. 您能找到同一个问题吗?

enter image description here 在此处输入图片说明

var jwt = require('jsonwebtoken');
var fs = require('fs');

//creating the payload for docusign
var payload = {
  "iss": "cb91877d-1d55-48ae-88d7-fd215c4fe2ca",
  "sub": "6cd4ea4e-3e68-4994-88b1-a321847cbf7e",
  "iat": 1509096042,
  "exp": 1509099042,
  "aud": "account-d.docusign.com",
  "scope": "signature impersonation",
  "name" :"name value" //not required
}

var cert = fs.readFileSync('private.pem');  // get private key
var token = jwt.sign(payload, cert, { algorithm: 'RS256'});
console.log(token)

console.log('---------------------------------------------------');
//printing the token to a file
fs.writeFile('jwttoken.txt', token, function (err) {
    if (err) 
        return console.log(err);

});

When the this generated token is used able to get post correct. 当使用此生成的令牌时,可以正确发布。 Earlier the token was printed on th console and copied from there which was creating the problem. 早些时候,令牌被打印在控制台上并从那里复制,这造成了问题。 @Larry K Thanks for the help with the scope claim. @Larry K感谢您对范围声明的帮助。

Remove nbf and name claims. 删除nbf和名称声明。

Change scope claim to "signature impersonation" 将范围声明更改为“签名模拟”

See https://docs.docusign.com/esign/guide/authentication/oa2_jwt.html#creating-the-jwt-token 参见https://docs.docusign.com/esign/guide/authentication/oa2_jwt.html#creating-the-jwt-token

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM