Following situation:
- We're using a third-party service to upload files to a specific drive folder within a specific google account (only possible way)
- A Zapier integration listens to new file creations and creates a new db entry with the metadata of the file
Now I'd like to set up a serverless cloud function that listens for new db entries, retrieves the fileId from the metadata then downloads the file and immediately uploads it to google cloud storage
My problem is to actually authenticate this download request. Ideally, there would be no OAUTH involved since it's literally a single drive we want to touch, which we also own.
I found some related solutions but they don't quite fit.
Google Drive API, Oauth and service account
How do I authorise an app (web or installed) without user intervention?
Basically I want to do this inside my serverles function:
const drive = google.drive({ version: "v3", auth: "WHAT_KEY_IS_NEEDED_HERE?" });
const zip = await drive.files.get({
fileId: "1iwXhoQfFvR8uVuVWAf1onq2O8Hs-M_0H",
alt: "media",
});
What key do I need to make authenticated requests? Can I use a service account or can I create a personal use token for this drive that is valid forever? The auth param can have several types: