mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 12:32:39 +00:00
Access google files with Service Account
Using API key is triggering "automation" warnings from Google
This commit is contained in:
@@ -257,7 +257,14 @@ GoogleActions = {
|
|||||||
throw ('Share ID does not match');
|
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,
|
fileId : id,
|
||||||
fields : 'description, properties',
|
fields : 'description, properties',
|
||||||
alt : 'media'
|
alt : 'media'
|
||||||
|
|||||||
Reference in New Issue
Block a user