2016-12-14 27 views
1

继此文档时:https://www.docusign.com/developer-center/explore/features/sobo“范围必须API”使代表发送卷曲请求

我已经建立了以下卷曲要求:

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); 
}); 

我使用这个网址也尝试过,但得到的“对象移动”响应:https://account-d.docusign.com/restapi/v2/oauth2/token

这没有意义对我来说,因为我有“的范围= API”就在的结束网址。这里发生了什么?

+0

看起来你已经包括您的代码示例在您的登录凭据。我建议您立即更改密码(通过DocuSign Web控制台)并更新代码示例以不包含实际的用户名/密码。 –

+0

谢谢Kim!建议听取了。你也可以在这里评论这个问题吗? – crdzoba

回答

0

后搜索的几天,我发现这个(矛盾)DOC:https://docs.docusign.com/esign/guide/authentication/sobo.html

原来你不需要做多步的OAuth令牌的过程就像我共享的第一个链接概述。您只需在您的X-DocuSign-Authentication标头中使用'SendOnBehalfOf'参数。

直接从该链接两者,它看起来就像这样:

{ 
    "Username": "[email protected]", 
    "Password": "S3cre+p455w0Rd", 
    "IntegratorKey": "230546a7-9c55-40ad-8fbf-af205d5494ad", 
    "SendOnBehalfOf": "[email protected]" 
}