Error with Excel Online Preview Using Box API

Hello everyone,

I’ve been encountering an intermittent issue when trying to use the Box API to preview Excel Online files. Sometimes the files load successfully, but at other times, I receive an error stating that the Excel Online Previewer encountered an error and suggests refreshing the page.

Here’s a snippet of the code I’m using:

var preview = new Box.Preview();
preview.enableViewers('Office');, accessToken, {
    container: "#preview-container",
    showDownload: true,

The access token is obtained on the server side using JWT authentication.

I am using the following URL version of JS via CDN:

Error Words:

Excel Online failed to load.

There was an error previewing your file with the Excel Online Previewer. Please refresh the page to try again.

The error resolves temporarily when I log out and then log back into Box, but it reappears if I log out again. This leads me to wonder if the issue might be related to how the login session or access tokens are being handled.

Has anyone else experienced something similar or have insights into what might be causing this issue? Any suggestions on how to ensure a more consistent behavior for the Excel Online preview functionality would be greatly appreciated.

Thank you in advance for your help and suggestions!

Best regards,