Google Apps Script apps stopped displaying images and returns 403 Forbidden

490 Views Asked by At

As of today, my google apps script stopped displaying images. I have been able to track it down and I'm getting the following error on my console:

Console

The link to the file is valid, so I'm not sure if something else has changed. https://drive.google.com/uc?id=1RbrHllGyqgPstq6u4vnzN-RqvlFh9Xm9

I have been trying to resolve this all day and I'm just at a loss. I read that it might be due to too many users and other things that I can't figure out.

It's a very basic web app that simply displays an image based on a status. This was working a few days ago.

I don't know what else to try.

Any insight is greatly appreciated.

I have tried recreating the app and many other things around authentication, but I haven't had any luck. The app still works it just doesn't display the images anymore.

1

There are 1 best solutions below

0
Tanaike On

I thought that the reason for your current issue might be due to this. So, in the current stage, how about using the following endpoint?

In this case, the file is required to be publicly shared. Please be careful about this.

https://drive.google.com/thumbnail?sz=w1000&id={fileId}

Note:

  • When I tested this endpoint, it seemed that the endpoint worked. But, the endpoints https://drive.google.com/uc?id={fileId} and https://drive.google.com/uc?id={fileId}&export=download cannot be used. The same issue as 403 occurred.

  • In the case of the above endpoint, the thumbnail image data is retrieved from the image file. But, if you want to retrieve the raw data from the file, as a simple method, I think that an API key can be also used. When the API key is used, the endpoint is as follows. This is from this thread. When you use the following endpoints, the file is required to be publicly shared. Please be careful about this.

    • iles except for Google Docs files:

      https://www.googleapis.com/drive/v3/files/[FILEID]?alt=media&key=[YOUR_API_KEY]
      
    • Google Docs files:

      https://www.googleapis.com/drive/v3/files/[FILEID]/export?mimeType=[mimeType]&key=[YOUR_API_KEY]
      

References: