4 Jun 2019

Auto-publish models to website

If you are working on models that you want to publish to your website then you can create a web service that you would only have to authorize once, and from then onwards it could keep accessing your files by generating new access tokens using the refresh tokenhttps://forge.autodesk.com/blog/about-refresh-token

You can also share the access token between the visitors of your website. Best thing is to only pass them one with viewables:read scope so it can only be used for viewing your models and nothing else.

It would be better to not provide an access token to the client (i.e. client side javascript code) at all, but make the Viewer pass its requests through your server: Securing your Forge Viewer token behind a proxy 
In that case we could make sure that only models inside the specific folder can be viewed.

Website workflowThe web app can be set up to only list the contents of one specific folder in your Fusion Team (or A360, etc) account. Once it's all done you will be able to just simply copy a model into the specific folder, and it will automatically show up on your website along with the other models. E.g. if you are working in Fusion 360 then you could do the copying right inside the product as well:

Fusion model copying

You can find the sample app's live version here: https://fusion-models.autodesk.io/ and source code here: https://github.com/adamenagy/models-website

Related Article