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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user