28 Sep 2023

Having issues with acmsession when loading ACC or BIM 360 designs?

Default blog image

Introduction

This blog addresses a workaround for a specific issue some applications might have when loading designs from ACC or BIM 360.

If you caught yourself in a situation where a user has access to a specific design through the product UI but not through your integration using Autodesk Platform Services, it might be associated with the issue described in this blog.

Before deep diving into this specific case, let's ensure it isn't something simpler.

Check this before using this workaround

If a user can access a design in Docs UI but not in your app, please check the list below:

  1. Your app is provisioned in the user's hub
  2. Your app has been provisioned with the correct permissions, just like in the image from this step 4 of the link shared previously
  3. Your token was acquired with the proper scopes
  4. It is the same urn you're trying to render in ACC UI and your app
  5. The token was acquired by the correct user 

If even after checking all of that, you're still receiving an error 401 (unauthorized) for the file, you might be experiencing a known issue we're working to solve.

The issue

Specific users added to a large number of groups in ACC might have their access denied on files through the API.

This is under investigation and we're working to get this fixed as soon as possible.

The workaround

While we don't have this fixed, there's a configuration you can apply to keep the wheels turning on your application.

First of all, your app needs to capture the scopes from the project that hosts the design.

It is returned by the GET projects endpoint, under attributes.scopes field.

After grabbing this value, you just need to join the values in a string (separated by a comma) and apply it before loading the urn, just like in the snippet below

export function loadModel(viewer, urn, scopes) {

    function onDocumentLoadSuccess(doc) {
        viewer.loadDocumentNode(doc, doc.getRoot().getDefaultGeometry());
    }
    function onDocumentLoadFailure(code, message) {
        alert('Could not load model. See console for more details.');
        console.error(message);
    }
    // For US Prod
    Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure, { 'x-ads-acm-scopes': scopes, 'x-ads-acm-namespace': 'WIPDM', 'x-ads-acm-check-groups': true });
    // For EMEA Prod
    // Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure, { 'x-ads-acm-scopes': scopes, 'x-ads-acm-namespace': 'WIPDMEMEAPROD', 'x-ads-acm-check-groups': true });
}

Usually scopes would have a value like "b360project.d50ed51e-...0efe7ced9,O2tenant.148...8"

With that, your app should be able to render those failing designs.

As soon as we have additional details on this issue we'll update this blog.

Related Article