Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

autodesk - Forge viewer to load file

I am able to load file in forge viewer. I have directly passing the current URN to loader function, its working without any token generation, conversion etc.(by simply passing urn only to loader function).

But the next day, I am passing same urn to loader function, the file is not loading. Next day onwards not working.

we need to view the file always. How its possible. Please help me on this.

thanks in advance.

question from:https://stackoverflow.com/questions/65914410/forge-viewer-to-load-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you're loading a model via URN (which means it's coming from the Forge Model Derivative service), you have to provide some kind of a token. It's possible that on the first day your application was somehow using a hard-coded token but on the next day that same token was no longer valid.

See in this example how we're passing a getAccessToken function to Autodesk.Viewing.Initializer: https://github.com/petrbroz/forge-basic-app/blob/develop/public/main.js#L1. This function will be used by Forge Viewer whenever it needs a new or refreshed token to download the model from the Forge Model Derivative service.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...