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=
).
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"
}'
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*/);
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.