Fix jwt-token

This commit is contained in:
2025-09-16 07:11:32 +02:00
parent 50f60035b5
commit fbd03aeffc
3 changed files with 31 additions and 1 deletions

View File

@@ -207,7 +207,19 @@ async function handleDetection(req, res) {
console.log('🔍 Complete detection data:', JSON.stringify(detectionData, null, 2));
// Check if device exists and is approved
console.log(`🔍 DEBUG: Looking for device with ID: ${detectionData.device_id} (type: ${typeof detectionData.device_id})`);
console.log(`🔍 DEBUG: Device model being used:`, Device);
console.log(`🔍 DEBUG: Sequelize instance:`, Device.sequelize.constructor.name);
// Get all devices to see what's actually in the database
const allDevices = await Device.findAll();
console.log(`🔍 DEBUG: Total devices in database: ${allDevices.length}`);
allDevices.forEach(d => {
console.log(` - Device ID: ${d.id} (type: ${typeof d.id}), name: ${d.name}, approved: ${d.is_approved}, active: ${d.is_active}`);
});
let device = await Device.findOne({ where: { id: detectionData.device_id } });
console.log(`🔍 DEBUG: Device lookup result:`, device ? `Found device ${device.id}` : 'Device not found');
if (!device) {
// Device not found - reject detection and require manual registration