EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
test-mesh-login.js
Go to the documentation of this file.
1/**
2 * Simple MeshCentral login test
3 */
4
5const https = require('https');
6
7const url = 'https://209.38.80.86:4430';
8const username = process.env.MESHCENTRAL_USERNAME || '~t:2jt4e92jNss43lyJ';
9const password = process.env.MESHCENTRAL_PASSWORD || '2GimaJ6MJDlq6P2Jrsso';
10
11console.log('Testing MeshCentral login...');
12console.log('URL:', url);
13console.log('Username:', username);
14
15const postData = JSON.stringify({
16 username: username,
17 password: password
18});
19
20const options = {
21 hostname: '209.38.80.86',
22 port: 4430,
23 path: '/login',
24 method: 'POST',
25 headers: {
26 'Content-Type': 'application/json',
27 'Content-Length': Buffer.byteLength(postData)
28 },
29 rejectUnauthorized: false
30};
31
32const req = https.request(options, (res) => {
33 console.log('Status Code:', res.statusCode);
34 console.log('Headers:', res.headers);
35
36 let body = '';
37 res.on('data', (chunk) => {
38 body += chunk;
39 });
40
41 res.on('end', () => {
42 console.log('Response Body:', body);
43
44 if (res.headers['set-cookie']) {
45 console.log('✅ Login successful! Got cookie:', res.headers['set-cookie'][0].substring(0, 50) + '...');
46 } else {
47 console.log('❌ No cookie received');
48 }
49 });
50});
51
52req.on('error', (e) => {
53 console.error('❌ Request failed:', e.message);
54});
55
56req.write(postData);
57req.end();