Skip to main content

Box Embed iframe

  • December 14, 2023
  • 6 replies
  • 261 views
Box Embed iframe

Hello everyone!,
I’m working on a website and I’m implementing box embed on iframes to show a preview of my files and I’be stuck because only on Chrome the preview of the iframe isn’t working, The iframe shows the message “We’re sorry, the preview hasn’t load. Please refresh the page.”

WhatsApp Image 2023-12-14 at 11.39.50

I’m using Box API to connect and validate my session and bring the shared urls of my files.
In firefox and other explorers this works without problems. ¿Any help?

Thanks!!

Did this topic help you find an answer to your question?

6 replies

smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • December 14, 2023

Hi - I’m going to create a ticket for you - Our internal eng team is going to investigate!


smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • December 15, 2023

Hello!

Do you mind sharing the code you are using to connect to the Box API and describe how it being used with Embed Widget?

Thanks.


  • Author
  • New Participant
  • 2 replies
  • December 18, 2023

Hi!, yes of course, I’m using Django 4.2 and this is my function:

try:
        print('Ehhh no salí por exception puti')
        JWT_CONFIG_PATH = 'config.json'
        print(JWTAuth)
        auth = JWTAuth.from_settings_file(JWT_CONFIG_PATH) # Im the error :)
        access_token = auth.authenticate_instance() 

        client = Client(auth)
        user = client.user().get()
        folder = client.folder(folder_id='0').get()
        items = client.folder(folder_id=str(folder.id)).get_items()

with this piece of code I look the items inside my root folder, and with each id get the shared_link with this code:

iframes = []
    for item in items:
            if item.type == 'file':
                try:
                    shared_link = client.file(item.id).get_shared_link()
                    iframes.append(str(shared_link))
                except Exception as error: 
                    print(error)

This bug appears randomly and it isn’t depend of the item, sometimes it happens with 1 item, another times with half of items and in other cases none loads correctly the preview.
Im using boxsdk library and Python 3.12.

Thanks! If you need to go deeper in my code let my know!


smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • December 18, 2023

Thank you for the details! I will start investigating, and I will let you know if we need more information.


  • Author
  • New Participant
  • 2 replies
  • January 3, 2024

Hi Smartoneok,
Have you figured out why this is happening? I urgently need determinate if I can use your API on my App and this bug its alarming.

I wait your answer

Thanks


smartoneinok Box
Forum|alt.badge.img

Hello! Sorry for the delay. I was out for the holidays. I created an internal ticket for our engineering teams to track this down. They should be contacting you soon. Thank you!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings