flat-wall-31132
04/17/2024, 11:13 AMfresh-fireman-491
04/17/2024, 12:14 PMflat-wall-31132
04/17/2024, 1:02 PMfresh-fireman-491
04/17/2024, 1:02 PMfresh-fireman-491
04/17/2024, 1:03 PMfresh-fireman-491
04/17/2024, 1:03 PMfresh-fireman-491
04/17/2024, 1:03 PMflat-wall-31132
04/17/2024, 1:10 PMflat-wall-31132
04/17/2024, 1:11 PMflat-wall-31132
04/17/2024, 1:14 PMflat-wall-31132
04/17/2024, 1:14 PMfresh-fireman-491
04/17/2024, 1:38 PMfresh-fireman-491
04/17/2024, 1:38 PMfresh-fireman-491
04/17/2024, 1:39 PMfresh-fireman-491
04/17/2024, 1:39 PMflat-wall-31132
04/17/2024, 1:45 PMflat-wall-31132
04/17/2024, 1:46 PMfresh-fireman-491
04/17/2024, 1:53 PMflat-wall-31132
04/17/2024, 2:34 PMfresh-fireman-491
04/17/2024, 2:44 PMfresh-fireman-491
04/17/2024, 2:44 PMcatch (error) {
// Improved error logging
console.error('Error fetching data:', error.response ? error.response.data : error.message);
}
fresh-fireman-491
04/17/2024, 2:44 PMfresh-fireman-491
04/17/2024, 2:45 PMfresh-fireman-491
04/17/2024, 2:45 PMcode here
fresh-fireman-491
04/17/2024, 2:46 PMflat-wall-31132
04/17/2024, 4:10 PM${username}:${password}
).toString('base64');
const response = await axios.get(https://10.134.130.27/api/extint/site/${data}
, {
headers: {
'Authorization': Basic ${authString}
// Add the Authorization header with the authString
},
httpsAgent: new https.Agent({ rejectUnauthorized: false }) // Ignore SSL certificate validation (optional)
});
console.log('Response data:', response.data);
} catch (error) {
// Improved error logging
console.error('Error fetching data:', error.response ? error.response.data : error.message);
}
}
fetchData();"fresh-fireman-491
04/17/2024, 4:14 PMfresh-fireman-491
04/17/2024, 4:14 PMfresh-fireman-491
04/17/2024, 4:14 PMflat-wall-31132
04/17/2024, 4:24 PMwitty-football-93730
04/17/2024, 4:32 PMhttpsAgent : https.Agent(/*...*/)
can you try just for fun remove the httpsAgent config in your axios requestflat-wall-31132
04/17/2024, 4:39 PMflat-wall-31132
04/17/2024, 4:40 PMflat-wall-31132
04/17/2024, 5:15 PMwitty-football-93730
04/17/2024, 5:16 PMwitty-football-93730
04/17/2024, 5:17 PMflat-wall-31132
04/17/2024, 5:20 PMwitty-football-93730
04/17/2024, 5:21 PMflat-wall-31132
04/17/2024, 5:27 PMwitty-football-93730
04/17/2024, 5:27 PMconst username = 'hello'
const password = 'secret'
let authString = `${username}:${password}`
if(typeof Buffer !== 'undefined'){
authString = Buffer.from(authString).toString('base64');
} else {
authString = btoa(authString)
}
try {
const response = await axios.get(`https://10.134.130.27/api/extint/site/${data}`, {
headers: {
'Authorization': `Basic ${authString}` // Add the Authorization header with the authString
},
});
console.log('Response data:', response.data);
} catch (error) {
// Improved error logging
console.error('Error fetching data:', error.response ? error.response.data : error.message);
}
witty-football-93730
04/17/2024, 5:29 PMwitty-football-93730
04/17/2024, 5:30 PMflat-wall-31132
04/17/2024, 5:35 PMflat-wall-31132
04/17/2024, 5:36 PMfresh-fireman-491
04/17/2024, 6:08 PMflat-wall-31132
04/18/2024, 2:37 AMfresh-fireman-491
04/18/2024, 6:08 AMflat-wall-31132
04/18/2024, 7:24 AMflat-wall-31132
04/18/2024, 8:44 AMfresh-fireman-491
04/18/2024, 10:17 AMflat-wall-31132
04/18/2024, 11:15 AMflat-wall-31132
04/18/2024, 11:42 AMwitty-football-93730
04/19/2024, 4:11 PMwitty-football-93730
04/19/2024, 4:20 PM