【发布时间】:2020-10-22 23:51:42
【问题描述】:
伙计们,你们好吗?
我想知道是否有人可以帮助我解决这个问题...
我正在尝试使用 JWT 将我的 API 与 DocuSign 集成。我从 DocuSign API 收到以下错误:
data: {
error: 'invalid_grant',
error_description: 'no_valid_keys_or_signatures'
}
根据 JWT 正确时发生的文档,但有些声明不正确。
这是文档链接:https://developers.docusign.com/platform/auth/jwt/jwt-get-token
我有点担心,因为我提出的声明与文档要求的完全一样。
连接授权已经完成。
这是我创建 JWT 的数据:
const data = {
iss: req.body.iss,
sub: req.body.sub,
name: req.body.name,
iat: timeStamp,
exp: timeStamp + 60 * 60 * 1000,
aud: req.body.aud,
scope: req.body.scope,
};
请求是:
{
"iss": "INTEGRATION_KEY",
"sub": "ACCOUNT_ID",
"name": "Ruben Acevedo",
"aud": "account-d.docusign.com",
"scope": "signature impersonation"
}
(为了隐私而更改密钥的值)
我正在像这样创建令牌:
const createToken = (data) => {
const privateKey = fs.readFileSync(key);
const token = jwt.sign(data, privateKey, {
algorithm: "RS256",
});
return token;
};
对docusign api的发布请求是这样的:
axios({
method: "post",
url: "https://account-d.docusign.com/oauth/token",
data: `grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=${token}`,
})
.then((response) => console.log(response))
.catch((e) => console.log(e));
});
你们能帮助新手完成他的项目吗?哈哈
提前谢谢大家!!
【问题讨论】:
-
您的到期时间以毫秒为单位...取出 * 1000 部分。
标签: node.js jwt docusignapi