Fix: Route force-oauth2 accessible sans authentification

This commit is contained in:
Claude committed 2025-11-12 14:06:02 +00:00
1 parent be8f95f413
commit 5ebaa72136
1 file changed
+4 -3
+4 -3
View File
@@ -114,14 +114,15 @@ async function getCalendarClient(userId = null) {
} }
/** /**
* GET /api/calendar/force-oauth2 (TEMPORAIRE - DEBUG) * GET /api/calendar/force-oauth2 (TEMPORAIRE - DEBUG - SANS AUTH)
* Forcer le type d'authentification à OAuth2 * Forcer le type d'authentification à OAuth2
* ATTENTION : Route sans authentification, à supprimer après utilisation
*/ */
router.get('/force-oauth2', requireAdmin, async (req, res) => { router.get('/force-oauth2', async (req, res) => {
try { try {
await runQuery("INSERT OR REPLACE INTO settings (key, value) VALUES ('google_auth_type', 'oauth2')", []); 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'"); const check = await getOne("SELECT value FROM settings WHERE key = 'google_auth_type'");
res.json({ success: true, auth_type: check?.value }); res.json({ success: true, auth_type: check?.value, message: 'Type changé vers OAuth2. Rechargez la page d\'administration.' });
} catch (error) { } catch (error) {
logger.error('Erreur:', error); logger.error('Erreur:', error);
res.status(500).json({ error: error.message }); res.status(500).json({ error: error.message });