Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...