Autodesk Forge 集成在 Webhook 创建中失败,错误 403

autodesk forge integration fails in webhook creation, error 403

我正在尝试创建一个应用程序来创建一些 Webhook 来捕获 Autodesk Data Management API 事件。

当我使用个人帐户创建应用程序进行测试时,它运行良好。我得到令牌,然后用它来创建 webhook。但是当我更改客户端 ID 和客户端密码以使用我需要工作的商业帐户时,它失败了。该应用程序由客户经理创建和集成,我很好地获得了具有正确范围的令牌(与我使用的个人帐户相同)。错误是 403,禁止访问。

我正在使用此 cUrl 命令进行测试: 1. 获取代币:

curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' \
  -X 'POST' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'client_id=<HERE_THE_CLIENT_ID>&client_secret=<HERE_THE_CLIENT_SECRET>&grant_type=client_credentials&scope=data:read%20data:create%20data:write%20user-profile:read%20viewables:read%20data:search%20account:read%20bucket:create%20bucket:read'
  1. 创建 Webhook:
curl -X 'POST' -v 'https://developer.api.autodesk.com/webhooks/v1/systems/data/events/dm.version.added/hooks' -H 'Content-Type: application/json' \
 -H 'authorization: Bearer <TOKEN_OBTAINED>' -d '{"callbackUrl": "http://<URL>.ngrok.io/api/forge/hook/callback","scope": {"folder": <FOLDER_URN>},"hookAttribute": {"projectId": "b.<PROJECT_ID>"}}'

这是我收到的错误消息:

  "status" : 403,
  "code" : "FORBIDDEN_ERROR",
  "detail" : [ "Access denied for resource <FOLDER_URN> in scope <FOLDER_URN> that you are trying to create hook on." ]

数据管理文件夹的 Webhooks 需要 3 legged tokens (i.e. it need user permission). See this nodejs sample

我通过更改请求中区域的 header 解决了这个问题! 检查这个:https://forge.autodesk.com/blog/bim-360-docs-webhooks-data-events-european-data-center