0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 12:32:39 +00:00

Add updateTokens param to GoogleActions/authCheck

This commit is contained in:
G.Ambatte
2022-11-29 10:00:23 +13:00
parent 090da33f33
commit 420d703f9d
2 changed files with 3 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ google.options({ auth: serviceAuth || config.get('google_api_key') });
const GoogleActions = {
authCheck : (account, res)=>{
authCheck : (account, res, updateTokens=true)=>{
if(!account || !account.googleId){ // If not signed into Google
const err = new Error('Not Signed In');
err.status = 401;
@@ -40,7 +40,7 @@ const GoogleActions = {
refresh_token : account.googleRefreshToken
});
oAuth2Client.on('tokens', (tokens)=>{
updateTokens && oAuth2Client.on('tokens', (tokens)=>{
if(tokens.refresh_token) {
account.googleRefreshToken = tokens.refresh_token;
}