Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

The function getViewerToken is called infinitely since today without any code change. Is this bug on our side or a bug in the forge viewer?

        iframe.viewer = new iframe.Autodesk.Viewing.GuiViewer3D(iframe.viewerDiv, { extensions: extensions });
        let options = {
            // 'env': 'AutodeskProduction',
            'env': 'MD20ProdEU', //svf2
            'api': 'D3S', //svf2
            'getAccessToken': function(onTokenReady) {
                     ...
            };
  .....

question from:https://stackoverflow.com/questions/65952570/why-is-viewer-getviewertoken-getting-called-infinite-times

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

The viewer calls the getAccessToken function whenever the token needs to be refreshed. When you're calling the callback function inside getAccessToken, make sure that the second parameter (expiration time of the new token in seconds) is a positive integer number. Perhaps your code is passing in zero or a negative number, forcing the viewer to repeatedly ask for new tokens.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...