The GLTF Viewer is a sample application that demonstrates:
The application is built using Express and is deployed on Heroku.
brew tap heroku/brew && brew install herokusudo snap install --classic herokuMake a bare clone of the sample app’s repository:
git clone --bare https://github.com/onshape-public/app-gltf-viewer.git
Navigate to your Github account and create a new, blank repository named app-gltf-viewer-clone
Copy the HTTPS URL of the repository you just created. You can find this on the Code tab in your repo.

cd <path-to-cloned-repo>/app-gltf-viewer.git
git push --mirror <copied-HTTPS-URL>
e.g.:
cd ~/Documents/onshape-public/app-gltf-viewer.git
git push --mirror https://github.com/<your-github-username>/app-gltf-viewer-clone.git
cd .. && rm -rf app-gltf-viewer.git
git clone https://github.com/<your-github-username>/app-gltf-viewer-clone.git
If using a different deployment platform, please refer to the platform's documentation for creating a new app.
app-gltf-viewer-yourname.gltf-viewer-yournamecom.yourname.gltf-viewerOnshape GLTF viewer sample app<Heroku-app-URL>/oauthRedirect
https://app-gltf-viewer-yourname-c11f263794bc.herokuapp.com/oauthRedirectNo Team<Heroku-app-URL>/oauthSignin
https://app-gltf-viewer-yourname-c11f263794bc.herokuapp.com/oauthSigninUtilities.Onshape in the Vendor field.gltf-viewer-yourname app appears on your Store entries page.gltf-viewer-yourname.gltf-viewerElement tab<Heroku-app-URL>
https://app-gltf-viewer-yourname-c11f263794bc.herokuapp.comMake sure Docker is open and running on your machine. You do not need to log in.
In your command line, run heroku login and follow the onscreen prompts to log in to your Heroku account.
Next, run:
cd <path-to-cloned-repo>
heroku git:remote -a app-gltf-viewer-yourname
(Note that you only need to do this step once. You can skip it the next time you log in.)
Finally, run:
heroku container:login
Run the following in the command line:
heroku config:set API_URL=https://cad.onshape.com/apiheroku config:set OAUTH_CALLBACK_URL=<heroku-app-URL>/oauthRedirect
heroku config:set OAUTH_CLIENT_ID=<client-id-from-created-app-in-dev-portal>
heroku config:set OAUTH_CLIENT_SECRET=<client-secret-from-created-app-in-dev-portal>
heroku config:set OAUTH_URL=https://oauth.onshape.comheroku config:set WEBHOOK_CALLBACK_ROOT_URL=<heroku-app-URL>/
heroku config:set SESSION_SECRET=<a-cryptographically-secure-string>
e.g.:
heroku config:set API_URL=https://cad.onshape.com/api
heroku config:set OAUTH_CALLBACK_URL=https://app-gltf-viewer-yourname-c11f263794bc.herokuapp.com/oauthRedirect
heroku config:set OAUTH_CLIENT_ID=VERYLONGSTRING=
heroku config:set OAUTH_CLIENT_SECRET=SECRETVERYLONGSTRING===
heroku config:set OAUTH_URL=https://oauth.onshape.com
heroku config:set WEBHOOK_CALLBACK_ROOT_URL=https://app-gltf-viewer-yourname-c11f263794bc.herokuapp.com
heroku config:set SESSION_SECRET=pink.ants.wear.purple.booties.at.midnight.37!
Run heroku config and confirm your settings are correct.
git commit -am "First commit"git push herokugltf-viewer-<yourname> and select it from the search results.
Note that if you have a complex model with a lot of parts, translating the model to GLTF can be time consuming. If you think there is an issue loading or rendering your model, you can open the Javascript console of your browser to check for any errors.
Once the model is rendered, the following controls are available to you:
That's it! Now you can use the gltf viewer in your Onshape documents, and you can refer to your app-gltf-viewer-clone repository in Github to see how the app handles authentication.