0

I am looking for​ guidance on how to configure authorization token management with automatic routing enabled in the Viewer SDK.

Our application sets up token refreshing using the getAccessToken callback in the Autodesk.Viewing.Initializer options, as outlined in the Getting Started Guide. Automatic routing is setup by setting the "DS_ENDPOINTS" flag. I can confirm that the access token callback is invoked on current token expiry and that the refreshed token is passed to onTokenReady. However, subsequent calls to Autodesk.Viewing.Document.load still seem to use the initial token even after it has expired instead of the new token sent in the callback. This results in 403 errors when the viewer attempts to fetch the document manifest and prevents documents from rendering successfully. Without the "DS_ENDPOINTS" feature enabled, token refreshing appears to work correctly. We are currently using version 7.110.1 of the viewer.

So far, I have attempted the following workarounds to properly handle token refreshing but none have been successful:

  1. Update to the recent viewer version: 7.112.1
  2. Manually setting the legacy endpoint headers at: Autodesk.Viewing.endpoint.HTTP_REQUEST_HEADERS.Authorization
  3. Passing the current authorization header in the options parameter of Autodesk.Viewing.Document.load

Steps to reproduce:

  1. Setup and start the aps-hubs-browser-nodejs
  2. Load a few different models
  3. Wait until initial token expiry (usually ~1 hr in my testing)
  4. Try loading the same models

Expected result: Models are rendered correctly

Actual result: The viewer reports an error and the models do not render. A 403 error is reported in the browser console.

6
  • Are you using the sample project as github.com/autodesk-platform-services/aps-hubs-browser-nodejs ? If so, can you change the way to base64 encode url at github.com/autodesk-platform-services/aps-hubs-browser-nodejs/… as follow to see if the issue could be solved: initTree('#tree', (id) => loadModel(viewer, Autodesk.Viewing.toUrlSafeBase64(id))); Commented Oct 7 at 0:51
  • just updated the repo to support auto region routing for the viewer. Commented Oct 7 at 1:37
  • Thanks for the quick reply @ZhongWu. We are using the SDK directly in our own application and we do use URL-safe Base64 encoding - models render correctly when a valid token is used. I was also able to reproduce this issue in aps-hubs-browser-nodejs and have added the steps to the original post. Please let me know if I can provide any more info. Commented Oct 7 at 17:35
  • Hi Anthony, I tried with our tutorial sample aps-hubs-browser-nodejs a couple of time, I manually changed the expires_at to simulate the token expiration, but i can not reproduce the issue as you mentioned. Are you able to contact us with ADN support system and we can have a quick talk to check the details? Commented Oct 9 at 20:13
  • 1
    Hi Anthony, looks I can reproduce this issue with aps-hubs-browser-nodejs now, the expired token seems still be cached while viewing these open model. Let me check more on this, btw, you may need to workaround this by refreshing the model. Commented Oct 10 at 1:11

1 Answer 1

0

To close the loop, token refreshing now works correctly with automatic routing with the latest update from Autodesk in Viewer SDK version 7.114.0.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.