76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>VisualLims Authentication</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 600px;
|
|
margin: 20px auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
#authButton {
|
|
padding: 10px 20px;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
#authButton:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
#result {
|
|
margin-top: 20px;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
word-wrap: break-word;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>VisualLims Authentication</h1>
|
|
<button id="authButton">Authenticate</button>
|
|
<div id="result"></div>
|
|
|
|
<script>
|
|
document.getElementById('authButton').addEventListener('click', async () => {
|
|
const resultDiv = document.getElementById('result');
|
|
resultDiv.textContent = 'Authenticating...';
|
|
|
|
try {
|
|
const response = await fetch('https://93.43.5.102/limsapi/api/authentication/authenticate', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
Username: 'WebApiUserTest',
|
|
Password: 'WebApiUserClienteTest'
|
|
})
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
const data = await response.json();
|
|
if (data && data.token) {
|
|
resultDiv.textContent = `Token: ${data.token}`;
|
|
} else {
|
|
resultDiv.textContent = 'Authentication failed: No token received';
|
|
}
|
|
} catch (error) {
|
|
resultDiv.textContent = `Error: ${error.message}`;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |