0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Defining default auth at the top

This commit is contained in:
Michiel De Mey
2023-03-07 11:02:47 +01:00
parent 4057d7bf84
commit 2a9ac9fa47
2 changed files with 84 additions and 65 deletions

View File

@@ -22,6 +22,8 @@ if(!config.get('service_account')){
}
}
const defaultAuth = serviceAuth || config.get('google_api_key');
const GoogleActions = {
authCheck : (account, res, updateTokens=true)=>{
@@ -134,7 +136,7 @@ const GoogleActions = {
},
updateGoogleBrew : async (brew)=>{
const drive = drive({ version: 'v3', auth: serviceAuth || config.get('google_api_key') });
const drive = drive({ version: 'v3', auth: defaultAuth });
await drive.files.update({
fileId : brew.googleId,
@@ -216,7 +218,7 @@ const GoogleActions = {
},
getGoogleBrew : async (id, accessId, accessType)=>{
const drive = drive({ version: 'v3', auth: serviceAuth || config.get('google_api_key') });
const drive = drive({ version: 'v3', auth: defaultAuth });
const obj = await drive.files.get({
fileId : id,
@@ -298,7 +300,7 @@ const GoogleActions = {
},
increaseView : async (id, accessId, accessType, brew)=>{
const drive = drive({ version: 'v3', auth: serviceAuth || config.get('google_api_key') });
const drive = drive({ version: 'v3', auth: defaultAuth });
await drive.files.update({
fileId : brew.googleId,