autodesk-forge不接受cURL请求范围

时间:2017-03-13 03:55:28

标签: curl oauth autodesk-forge

无法获得Forge的初始访问令牌,看起来我跟随T教程,但没有运气。

https://developer.autodesk.com/en/docs/oauth/v2/reference/http/authenticate-POST/

我通过Cygwin在Windows上运行curl。

curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content_Type: application/x-www-form-urlencoded' -d 'client_id=000000000000000000000000000000000&client_secret=0000000000000000&grant_type=client_credentials&scope=data:read'

我得到的是......

< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Mon, 13 Mar 2017 03:50:00 GMT
* Server Apigee Router is not blacklisted
< Server: Apigee Router
< Content-Length: 210
< Connection: keep-alive
<
* STATE: PERFORM => DONE handle 0x600057680; line 1981 (connection #0)
* multi_done
* Curl_http_done: called premature == 0
* Connection #0 to host developer.api.autodesk.com left intact
{"developerMessage":"Requested scopes must be blank or a subset of the provided scopes.","userMessage":"","errorCode":"AUTH-004","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-004"}

不确定发生了什么。我要求的范围实际上是错误的吗?

2 个答案:

答案 0 :(得分:1)

感谢您的链接。那里有一些不错的信息。 JQ肯定会让事情变得更加愉快。

事实证明我的问题是shell脚本的编码我正在将命令写入dos。将其设置为unix允许我的args被正确解释。

答案 1 :(得分:0)

您可以查看我在此帖子中设置的步骤,该帖子还通过cURL获取了一个2legged身份验证令牌。我已经使用OSX终端和Windows Cygwin测试了两种方案。

https://forge.autodesk.com/blog/tutorial-using-curl-2-legged-authentication-model-translation

干杯