Using Google drive API to load images from a folder give me error 403

108 views Asked by At

I'm using the google drive api to load on my websites multiple images from a folder, It works fine one month ago, now is not working anymore, I didn't change the API key and even the folder id is still the same. I can get the array correctly on my console log, I can get correctly the url of the images, if I copy the src of the tag images in my browser I can see the image correctly, but can't see it on my page.

enter image description here

1

There are 1 answers

2
Serenity On

Current Behavior

Upon investigation, most users who use Google Drive to host files on their website are getting error 403. This is due to recent changes that browsers including Google Chrome started phasing out third-party cookies to increase privacy and security of user accounts.

Due to those changes, Google Drive starts requiring authorization for files hosted on third party services, and this affects those who use Drive's URL.

Recommended Workaround

  1. Use an iframe to load the content on your website. You can use this pattern:

image

Note: You can generate the Drive link by following the steps below:

  • For other files, once opened in Drive, select “Open in new window” from the overflow menu, and then open the overflow menu and select “Embed item…”, which provides the iframe HTML tag.
  1. Move files to any file hosting provider and fetch files to your website

  2. Use Google Drive API to pull your necessary files from your Google Drive and pass it to your chosen proxy e.g. Google Cloud functions to deliver to any third-party interfaces like websites, presentation etc.

References: