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:
- Update to the recent viewer version:
7.112.1 - Manually setting the legacy endpoint headers at:
Autodesk.Viewing.endpoint.HTTP_REQUEST_HEADERS.Authorization - Passing the current authorization header in the
optionsparameter ofAutodesk.Viewing.Document.load
Steps to reproduce:
- Setup and start the
aps-hubs-browser-nodejs - Load a few different models
- Wait until initial token expiry (usually ~1 hr in my testing)
- 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.
aps-hubs-browser-nodejsand have added the steps to the original post. Please let me know if I can provide any more info.