0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 12:02:48 +00:00

Access google files with Service Account

Using API key is triggering "automation" warnings from Google
This commit is contained in:
Trevor Buckner
2020-12-25 15:15:51 -05:00
committed by GitHub
parent 3dba731dd7
commit 8e1951ba67

View File

@@ -257,7 +257,14 @@ GoogleActions = {
throw ('Share ID does not match');
}
const file = await drive.files.get({
//Access actual file with service account. Just api key is causing "automated query" errors.
const keys = JSON.parse(config.get('service_account'));
const serviceAuth = google.auth.fromJSON(keys);
serviceAuth.scopes = ['https://www.googleapis.com/auth/drive'];
const serviceDrive = google.drive({ version: 'v3', auth: serviceAuth });
const file = await serviceDrive.files.get({
fileId : id,
fields : 'description, properties',
alt : 'media'