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

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

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.

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!

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

1 Like

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

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!