按照此处的文档:https://www.docusign.com/developer-center/explore/features/sobo
我已经构建了以下curl请求:
curl --request POST \
--url 'https://demo.docusign.net/restapi/v2/oauth2/token?grant_type=password&client_id=<my integrator key>username=<my email>&password=<my password>&scope=api' \
--header 'accept: application/json' \
--header 'cache-control: no-cache' \
--header 'content-length: 0' \
--header 'content-type: application/x-www-form-urlencoded' \
然而,当我运行这个时,我得到了这个回复
{
"error": "invalid_scope",
"error_description": "Scope must be 'api'."
}
当我在nodejs
中运行类似的调用时,我得到同样的东西var request = require("request");
var options = { method: 'POST',
url: 'https://demo.docusign.net/restapi/v2/oauth2/token',
qs:
{ grant_type: 'password',
client_id: '',
username: '',
password: '',
scope: 'api' },
headers:
{ 'cache-control': 'no-cache',
'content-length': '0',
accept: 'application/json',
'content-type': 'application/x-www-form-urlencoded' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
我也试过使用这个网址,但得到一个&#34;对象被移动&#34;回复:https://account-d.docusign.com/restapi/v2/oauth2/token
这对我没有意义,因为我确实有&#34; scope = api&#34;就在网址的末尾。这是怎么回事?
答案 0 :(得分:0)
经过几天的搜索,我发现了这个(矛盾的)文档:https://docs.docusign.com/esign/guide/authentication/sobo.html
事实证明,您不需要像我分享的第一个链接中概述的那样执行多步OAuth令牌过程。你只需要一个“SendOnBehalfOf”&#39; X-DocuSign-Authentication标头中的参数。
直接从该链接中获取,它将如下所示:
{
"Username": "nat.irving@example.com",
"Password": "S3cre+p455w0Rd",
"IntegratorKey": "230546a7-9c55-40ad-8fbf-af205d5494ad",
"SendOnBehalfOf": "ruggiero.gardener@example.com"
}