我试图使用DocuSign REST并创建一个OAuth请求来执行(SOBO)的发送。虽然我不能完成第一项任务,但它给了我一个糟糕的要求。我做错了什么?
带有标头的请求:
POST https://demo.docusign.net/restapi/v2/oauth2/token
Accept: application/xml
Content-Type: application/xml
Content-Length: {length of body}请求体
<OAuthTokenRequest>
<grant_type>password</grant_type>
<client_id>{IntegratorKey}</client_id>
<username>test@email.com</username>
<password>{Password}</password>
<scope>api</scope>
</OAuthTokenRequest>错误响应:
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>发布于 2014-03-06 17:43:44
尽管大多数DocuSign REST都接受XML格式设置,但OAuth请求必须以x-www-form-urlencoded格式发出。
将请求更改为以下内容:
带有标头的请求:
POST https://demo.docusign.net/restapi/v2/oauth2/token
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
Content-Length: {length of body}请求主体:
grant_type=password&client_id={IntegratorKey}&username=test@email.com&password={Password}&scope=api示例响应:
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>https://stackoverflow.com/questions/22232036
复制相似问题