URL of GoogleDrive Media Files Fetched From Backend Not Working

What I’m trying to do: I’m using the GoogleDrive integration to save and fetch media objects. When I fetch the urls directly from the frontend, i get a random url prefixed with google drive. This works well but thinking that it’d be more efficient to prefetch the urls from the backend and serve the frontend, I transferred the same code to the backend. I do get the urls but they’re prefixed with my app name. Moreover, these urls don’t work most of the time, even when I try to refresh them every minute. In some cases, I get this error Bad request: Invalid (Lazy) Media object.

What I’ve tried and what’s not working: I have not been able to find the GoogleDrive API documentation that’d have pointed me in the right direction. I have raised a separate Q&A for this.

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 
rows = app_tables.vehicles.search(imgs_folder_id = q.not_(None))
  for r in rows:
    folder = app_folder.get_by_id(r['imgs_folder_id'])
    r['main_img_url'] = folder.get_by_id(r['main_img_id']).get_url()
    r['images'] = [f.get_url() for f in folder.list_files()]

Clone link:
share a copy of your app

This error has been mentioned many times on this Forum. I suggest you use Forum Search, and see how this can happen. This may shed light on the larger problem.