Skip to main content
New Participant
Dec 14, 2023 2:42 PM UTC

Box Embed iframe

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!!

6 replies

smartoneinok Box
Senior Developer Advocate
Dec 14, 2023 8:01 PM UTC

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

Translate
smartoneinok Box
Senior Developer Advocate
Dec 15, 2023 4:12 PM UTC

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.

Translate
New Participant
Dec 18, 2023 5:39 PM UTC

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!

Translate
smartoneinok Box
Senior Developer Advocate
Dec 18, 2023 5:51 PM UTC

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

Translate
New Participant
Jan 3, 2024 2:14 PM UTC

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

Translate
smartoneinok Box
Senior Developer Advocate
Jan 8, 2024 6:09 PM UTC

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!

Translate