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

Posted By

Eason Kang

Eason Kang is a member of the Autodesk Developer Network ADN DevTech team, focusing on providing programming support, consulting, training and evangelism to external developers. He started his career in Taiwan and now lives in Taipei, Taiwan. He is a developer consultant in the team DevTech, the worldwide team of API gurus providing technical services through the Autodesk Developer Network. He supports various...

João Martins

João Martins

Joined the Developer Advocates team in 2020, João works mostly with .NET application. He is a Civil Engineer graduate with experience in software development. You can count on him to help you with your AEC related topics.

Jaime Rosales

Jaime Rosales

Jaime Rosales is a Senior Developer Advocate with Autodesk Forge. He’s part of the team that helps partners/customers create new products and transition to the cloud with the use of Autodesk’s new Platform - Forge. He joined Autodesk in 2011 through the acquisition of Horizontal Systems the company that developed the cloud-based collaboration systems—now known as BIM 360 Glue the Glue. He was responsible for...