diff --git a/gmail-agent/index.js b/gmail-agent/index.js index 6bfcc21..b7703a4 100644 --- a/gmail-agent/index.js +++ b/gmail-agent/index.js @@ -28,12 +28,11 @@ function loadAuth() { console.warn('⚠️ Missing credentials.json. Gmail Agent will not be able to process emails or authenticate new accounts until this file is provided.'); return; } - if (!fs.existsSync(TOKENS_DIR)) { - fs.mkdirSync(TOKENS_DIR, { recursive: true }); - console.log('Created empty tokens directory.'); - } - - try { + if (!fs.existsSync(TOKENS_DIR)) { + fs.mkdirSync(TOKENS_DIR, { recursive: true }); + console.log('Created empty tokens directory.'); + } + const creds = getCredentials(); const {client_secret, client_id, redirect_uris} = creds.installed || creds.web; baseOAuth2Client = { client_id, client_secret, redirect_uri: redirect_uris[0] || 'urn:ietf:wg:oauth:2.0:oob' };