[英]DocuSignAPI REST - Why won't my OAuth request go through?
I'm attempting to use the DocuSign REST API and create an OAuth request to execute Send of Behalf of (SOBO). 我正在尝试使用DocuSign REST API并创建OAuth请求以执行(SOBO)的“代表发送”。 Although I can't complete the first task, it's giving me back a Bad Request. 尽管我无法完成第一个任务,但这给了我一个不好的要求。 What am I doing wrong? 我究竟做错了什么?
Request with Headers: 带标题的请求:
POST https://demo.docusign.net/restapi/v2/oauth2/token
Accept: application/xml
Content-Type: application/xml
Content-Length: {length of body}
Request Body 请求正文
<OAuthTokenRequest>
<grant_type>password</grant_type>
<client_id>{IntegratorKey}</client_id>
<username>test@email.com</username>
<password>{Password}</password>
<scope>api</scope>
</OAuthTokenRequest>
Response with Error: 错误回应:
400 Bad Request
<oauthErr xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<error>invalid_request</error>
<error_description>An OAuth2 error occurred:</error_description>
</oauthErr>
Although most of the DocuSign REST API accepts XML formatting, OAuth requests must be made in x-www-form-urlencoded . 尽管大多数DocuSign REST API都接受XML格式,但是OAuth请求必须以x-www-form-urlencoded进行 。
Change your request to the following: 将您的请求更改为以下内容:
Request with Headers: 带标题的请求:
POST https://demo.docusign.net/restapi/v2/oauth2/token
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
Content-Length: {length of body}
Request Body: 请求正文:
grant_type=password&client_id={IntegratorKey}&username=test@email.com&password={Password}&scope=api
Sample Response: 样本响应:
200 OK
<oauthAccess xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<access_token>{Access Token}</access_token>
<scope>api</scope>
<token_type>bearer</token_type>
</oauthAccess>
More information can be obtained in this documentation . 可以在本文档中获取更多信息 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.