Skip to main content

Preview error on Content Explorer Widget

  • August 8, 2023
  • 7 replies
  • 395 views
Preview error on Content Explorer Widget

I am getting the following error while previewing a file.

The error message says, The document may be protected, but I am able to preview the same if i use a new downscoped token.

Form network tab, It seems when we click on preview, it tries to download the resource, but the resource is not found.
image

When I tried hitting the same API in postman. I got the following response.

This happens when I try to preview a documents after some interval of 10-15 minutes. Is there a solution available to explain the underlying cause of this behavior?

7 replies

  • Author
  • Known Participant
  • August 9, 2023

Steps to reproduce the above issue:

  1. Create a downscoped token with the following scopes.
    base_explorer, item_preview, item_download, item_upload
  2. Use the generated token in the Content Explorer widget.
  3. Preview a file 3-4 times.
  4. Wait for 15-20 minutes
  5. Preview the same file again. (The above error appears on the widget.)

rbarbosa Box
Forum|alt.badge.img
  • Developer Advocate
  • August 9, 2023

Hi @Niladri ,

Downscope tokens do not automatically renew, not even via the SDK’s, however I would expect the token to be live for 60 minutes and get a 403 if expired, not a 404.

I’ll ask my team about this case too.


  • Author
  • Known Participant
  • August 9, 2023

Hi @rbarbosa,

The downscoped token maintains its validity for nearly an hour. Therefore, any potential errors shouldn’t arise until after this 60-minute window has passed. Strangely though, when I reload the page, the Content Explorer displays the file list, confirming the token’s validity. Nevertheless, I encounter problems when attempting to preview the file.

Certainly, I appreciate your willingness to involve your team in addressing this case. Your collaboration is valuable, and I look forward to any insights or updates your team can provide.


  • Author
  • Known Participant
  • August 10, 2023

The same issue appears on the Content Explorer widget on the box’s Content Explorer documentation website. The behavior is observed specifically while previewing PDF files.

Content Explorer - Box Developer Documentation


  • Author
  • Known Participant
  • August 14, 2023

Hi @rbarbosa / Team,

Is there any update on this issue?


rbarbosa Box
Forum|alt.badge.img
  • Developer Advocate
  • August 15, 2023

Sorry @Niladri , not yet… 😦

On a brighter side, you did inspire me to create a UI Elements workshop…

Check it out and send your feedback at:

Cheers


  • Author
  • Known Participant
  • August 17, 2023

That’s fantastic to hear! I’m really glad to have been an inspiration for your UI Elements workshop. It sounds like a great initiative, especially with the focus on a pure Javascript approach to cater to a wider range of stacks. I’ll definitely check out the Box UI Elements Workshop and provide you with my feedback.

Keep up the great work!