下面是文档: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);
});我也尝试使用这个url,但得到一个“对象移动”响应:https://account-d.docusign.com/restapi/v2/oauth2/token
这对我来说毫无意义,因为我在网址的末尾有"scope=api“。这里发生什么事情?
发布于 2016-12-16 22:47:51
经过几天的搜索,我发现了这个(矛盾的)文档:https://docs.docusign.com/esign/guide/authentication/sobo.html
原来,您不需要像我共享的第一个链接中所概述的那样,执行多步OAuth令牌过程。您只需在中使用“SendOnBehalfOf”参数即可。
直接从该链接中获取,它将如下所示:
{
"Username": "nat.irving@example.com",
"Password": "S3cre+p455w0Rd",
"IntegratorKey": "230546a7-9c55-40ad-8fbf-af205d5494ad",
"SendOnBehalfOf": "ruggiero.gardener@example.com"
}https://stackoverflow.com/questions/41133501
复制相似问题