从Autodesk A360使用URN创建查看器应用程序 [英] Creating a viewer application with an URN from Autodesk A360

查看:116
本文介绍了从Autodesk A360使用URN创建查看器应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个使用两足式身份验证的查看器应用程序,并显示已上传到我自己的存储桶中的项目.现在,我不想查看自己的存储桶中的项目,而是希望查看已经上传到Autodesk A360的项目.

I have created a viewer application which uses 2-legged authentication and displays the project that has been uploaded to my own bucket. Now instead of viewing the project in my own bucket, I would like to be able to view a project that has been already uploaded to Autodesk A360.

为此,我已完成以下步骤:

For that I have completed the following steps:

  • 实施三足式身份验证(具有项目的A360帐户和要进行身份验证的帐户相同).
  • 按照
  • Implemented the 3-legged authentication (A360 account with the project and the account that is being authenticated are the same).
  • Accessed the hub, project and the file, as described in https://developer.autodesk.com/en/docs/data/v2/tutorials/download-file/.
  • Instead of downloading the project and uploading it to my own bucket, as described in https://developer.autodesk.com/en/docs/data/v2/tutorials/app-managed-bucket/, gotten the identificator (urn:adsk.wipprod:fs.file:vf.6bVr4EVDSaOpykczeQYR2Q?version=1) from the result of the file request and converted it to an URL-friendly Base64 (dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXktYnVja2V0L215LWF3ZXNvbWUtZm9yZ2UtZmlsZS5ydnQ=).

因此,转换后的URN应该与A360用于其自己的查看器的相同.

As a result, the converted URN should be the same as A360 is using for its own viewer.

在我自己的应用程序上使用URN查看项目时,网络控制台将显示以下错误消息:

When viewing the project with the URN on my own application, the network console is displaying the following error message:

查看特定请求时,将返回以下响应:

When looking at the specific request, the following response is returned:

我还确保转换后的URN等于A360正在使用的URN.为此,我将其与A360的响应进行了比较:

I also made sure that the converted URN is equal to the URN that the A360 is using. For that I compared it with the response of A360:

因此,当查看器在A360中工作时,我想知道是否也可以在我自己的应用程序中查看A360中的项目(A360查看器已经存在该存储桶,因此没有理由重复执行相同的步骤存储桶的创建和文件上传). 如果可以使用与URN相同的项目,那么我也想知道为什么该请求是未授权的.

So as the viewer works in A360, I would like to know whether the project in A360 can be also viewed in my own application (the bucket already exists for the A360 viewer, so there is no reason for repeating the same process of bucket creation and uploading of the file). If the same project with the URN can be used, then I would also like to know why the request is unauthorized.

如果您需要任何其他代码,请务必询问.

If you need any additional code, then make sure to ask.

推荐答案

After comparing my solution against Augusto Goncalves' application at https://github.com/Developer-Autodesk/data.management.api-nodejs-sample, I finally managed to solve the problem.

  • Instead of downloading the project and uploading it to my own bucket, as described in https://developer.autodesk.com/en/docs/data/v2/tutorials/app-managed-bucket/, gotten the identificator (urn:adsk.wipprod:fs.file:vf.6bVr4EVDSaOpykczeQYR2Q?version=1) from the result of the file request and converted it to an URL-friendly Base64 (dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXktYnVja2V0L215LWF3ZXNvbWUtZm9yZ2UtZmlsZS5ydnQ=).

尽管此方法返回了正确的URN,但除了URN之外,还必须将acmsession添加到请求中.从上面的示例代码中,我设法对以下请求进行了反向工程:

Although this method returns a correct URN, then in addition to URN an acmsession must be also added to the request. From the sample code above, I managed to reverse-engineer the following request:

curl -X 'POST' \
 -H "Authorization: Bearer $token" -H 'Content-Type: application/json' \
 -v 'https://developer.api.autodesk.com/oss-ext/v1/acmsessions' -d \
 '{
    "application": "autodesk",
    "x-ads-acm-check-groups": "true",
    "x-ads-acm-namespace": "WIPDM"
  }'

此请求的结果返回一个代码,必须将其添加到URN中.与其将其添加到请求URL的末尾,不如将其添加到正在调用的方法中:

The result of this request returns a code, which must be added to the URN. Instead of adding it to the end of request URL, it should be added to the method that is being called:

viewer.load(doc.getViewablePath(geometryItems[0]), null, null, null, doc.acmSessionId /*session for DM*/);

使用此解决方案需要对查看器的实例进行更改.而不是像 https://developer.autodesk .com/zh-CN/docs/viewer/v2/tutorials/basic-viewer/,我将其更改为上面示例代码的index.js文件中的解决方案.

Using this solution required changes to be made to the instantiation of the viewer. Instead of doing it like described in https://developer.autodesk.com/en/docs/viewer/v2/tutorials/basic-viewer/, I changed it to the solution that is in index.js file of the sample code above.

这篇关于从Autodesk A360使用URN创建查看器应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆