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://fusionmodels.herokuapp.com/ and source code here: https://github.com/adamenagy/models-website

Related Article

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...