-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-auth.js
More file actions
31 lines (26 loc) · 865 Bytes
/
test-auth.js
File metadata and controls
31 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Simple test to verify authentication functionality
import fetch from 'node-fetch';
async function testAuth() {
try {
console.log('Testing authentication with wrong word...');
const response = await fetch('http://localhost:5010/api/authenticate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
secretWord: 'wrongword'
})
});
const data = await response.json();
console.log('Auth response:', data);
if (data.ok) {
console.log('Authentication successful!');
} else {
console.log('Authentication failed:', data.error);
}
} catch (error) {
console.error('Error testing authentication:', error.message);
}
}
testAuth();