Merge pull request #44 from R0m1k3/claude/integrate-google-calendar-api-011CV44Nie9HB7U35ArSUnNa

Claude/integrate google calendar api 011 cv44 nie9 hb7 u35 ar s un na
This commit is contained in:
LogiFlow authored and GitHub committed 2025-11-12 15:06:52 +01:00
commit cf95c088a2
2 files changed
+60

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
// Script pour corriger les paramètres Google Calendar
const { getAll, runQuery } = require('./config/database');
async function fixGoogleSettings() {
console.log('🔍 Vérification des paramètres Google Calendar...\n');
// Lire tous les paramètres Google
const googleSettings = await getAll("SELECT key, value FROM settings WHERE key LIKE 'google%'");
console.log('📋 Paramètres actuels :');
googleSettings.forEach(setting => {
let displayValue = setting.value;
// Masquer les secrets
if (setting.key.includes('secret') || setting.key.includes('key')) {
displayValue = setting.value ? '***MASQUÉ***' : 'NULL';
}
console.log(` ${setting.key}: ${displayValue}`);
});
// Vérifier le type d'authentification
const authType = googleSettings.find(s => s.key === 'google_auth_type');
console.log(`\n🔐 Type d'authentification actuel: ${authType?.value || 'NON DÉFINI'}`);
// Forcer OAuth2
console.log('\n✏️ Changement du type d\'authentification vers OAuth2...');
await runQuery(
"INSERT OR REPLACE INTO settings (key, value) VALUES ('google_auth_type', 'oauth2')",
[]
);
console.log('✅ Type d\'authentification changé vers OAuth2');
// Vérifier à nouveau
const newAuthType = await getAll("SELECT value FROM settings WHERE key = 'google_auth_type'");
console.log(`\n✅ Nouveau type: ${newAuthType[0]?.value}`);
console.log('\n🎉 Terminé ! Redémarrez votre application et réessayez.');
process.exit(0);
}
fixGoogleSettings().catch(err => {
console.error('❌ Erreur:', err);
process.exit(1);
});
+16
View File
@@ -113,6 +113,22 @@ async function getCalendarClient(userId = null) {
}
}
/**
* GET /api/calendar/force-oauth2 (TEMPORAIRE - DEBUG - SANS AUTH)
* Forcer le type d'authentification à OAuth2
* ATTENTION : Route sans authentification, à supprimer après utilisation
*/
router.get('/force-oauth2', async (req, res) => {
try {
await runQuery("INSERT OR REPLACE INTO settings (key, value) VALUES ('google_auth_type', 'oauth2')", []);
const check = await getOne("SELECT value FROM settings WHERE key = 'google_auth_type'");
res.json({ success: true, auth_type: check?.value, message: 'Type changé vers OAuth2. Rechargez la page d\'administration.' });
} catch (error) {
logger.error('Erreur:', error);
res.status(500).json({ error: error.message });
}
});
/**
* GET /api/calendar/auth-url
* Générer l'URL d'authentification OAuth