【问题标题】:Curl 2-Legged Token with Autodesk Forge fails (AUTH-008)使用 Autodesk Forge 的 Curl 2-Legged 令牌失败 (AUTH-008)
【发布时间】:2017-03-29 04:21:57
【问题描述】:

我正在尝试获取如下所示的两足令牌:https://developer.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/

这是我在 cygwin 中输入的(id 和 secret 是示例中的,但我使用自己的 id 和 secret):

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

但我明白了:

< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Tue, 15 Nov 2016 10:06:09 GMT
* Server Apigee Router is not blacklisted
< Server: Apigee Router
< Content-Length: 231
< Connection: keep-alive
<
* STATE: PERFORM => DONE handle 0x600057550; line 1965 (connection #0)
* multi_done
* Curl_http_done: called premature == 0
* Connection #0 to host developer.api.autodesk.com left intact
{"developerMessage":"The required parameter(s) client_id,client_secret,grant_type not present in the request","userMessage":"","errorCode":"AUTH-008","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-008"}

我从网站上获取的示例中怎么可能缺少参数?

【问题讨论】:

    标签: curl autodesk autodesk-forge


    【解决方案1】:

    每个有经验的程序员都非常清楚,错误发生的方式没有任何限制。

    在这种情况下,在您指定范围之前,我在您的数据中看到了一个空格。

    可能是这个原因吗?

    client id 前面还有一个前导空格。

    也许那个被忽略了。

    以下是您正在尝试实现的工作示例:

    http://thebuildingcoder.typepad.com/blog/2016/10/forge-intro-formats-webinars-and-fusion-360-client-api.html#3

    【讨论】:

    • 它有效,看起来我那里有更多空间。我不知道它对白色空间如此敏感。为什么他们不使用空格修剪或标记?
    猜你喜欢
    • 2021-04-11
    • 2021-04-06
    • 2016-12-20
    • 1970-01-01
    • 2023-03-19
    • 2021-12-27
    • 2020-09-17
    • 2019-10-02
    • 1970-01-01
    相关资源
    最近更新 更多