【问题标题】:Forge authentication failure while trying to get a token: error 404尝试获取令牌时伪造身份验证失败:错误 404
【发布时间】:2020-07-31 01:23:15
【问题描述】:

我正在尝试为我的 forge 应用程序创建一个 2-legged 身份验证令牌,但我无法得到任何人,因为我被告知资源不存在。当我在 VS 2019 的开发人员命令提示符中运行此行时:

`curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate"-X "POST"-H "Content-Type:application/x-www-form-urlencoded"-d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<edited-out>&grant_type=client_credentials&scope=data:read"`

我收到以下消息:

`< HTTP/1.1 404 Not Found
< Date: Fri, 17 Apr 2020 13:30:41 GMT
< Content-Type: application/json
< Content-Length: 205
< Connection: keep-alive
< Access-Control-Allow-Origin:
< Access-Control-Allow-Methods: POST,GET,OPTIONS,HEAD,PUT,DELETE,PATCH
< Access-Control-Allow-Headers: Content-Length,x-ads-ul-ctx-client-id,x-ads-ul-ctx-caller-span- 
id,Content-Range,Access-Control-Allow-Origin,Authorization,x-ads-test,x-ads-ul-ctx-oxygen-id,x-ads- 
acm-scopes,x-ads-ul-ctx-head-span-id,If-Match,x-ads-ul-ctx-source,Accept-Encoding,If-Modified- 
Since,x-ads-acm-namespace,Access-Control-Allow-Credentials,x-ads-acm-groups,Session-Id,Content- 
Encoding,x-ads-ul-ctx-scope,Range,Accept,x-ads-ul-ctx-workflow-id,x-requested-with,Expect,x-ads-acm- 
check-groups,If-None-Match,Content-Type,x-csrf-token
< Access-Control-Allow-Credentials: true
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
{ "developerMessage":"The requested resource does not exist.", "moreInfo": 
"https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", "errorCode": 
"org.mozilla.javascript.Undefined@0"}* Connection #0 to host developer.api.autodesk.com left intact`

我已经没有想法了。我首先关注的是 Autodesk 教程 https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/

【问题讨论】:

    标签: autodesk-forge bearer-token


    【解决方案1】:

    curl 命令似乎格式错误。所有不同的参数都应该用空格分隔,例如:

    curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate" -X "POST" -H "Content-Type:application/x-www-form-urlencoded" -d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<your-app-secret>&grant_type=client_credentials&scope=data:read"
    

    另外,请勿分享您的客户端应用密码。返回https://forge.autodesk.com/myapps 下的 Forge 应用程序并生成一个新的客户端密码,这样任何人都无法使用您在此处粘贴的密码。

    【讨论】:

    • 感谢您的快速回答!现在似乎可以工作 PS:客户端密码是错误的代码
    猜你喜欢
    • 2015-05-10
    • 2013-12-04
    • 2015-06-01
    • 1970-01-01
    • 2020-06-23
    • 2021-11-28
    • 2018-07-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多