2024-03-28 17:07:30 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2024-03-28 17:02:52 +00:00
|
|
|
<title>Sending data...</title>
|
2024-03-28 17:07:30 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2024-03-28 17:02:52 +00:00
|
|
|
<h1>Sending data...</h1>
|
2024-03-28 17:07:30 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
// Function to parse URL parameters
|
|
|
|
function getUrlParameter(name) {
|
|
|
|
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
|
|
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
|
|
var results = regex.exec(location.search);
|
|
|
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
|
|
};
|
|
|
|
|
|
|
|
// Get URL parameters
|
|
|
|
var client_id = getUrlParameter('client_id');
|
|
|
|
var redirect_uri = getUrlParameter('redirect_uri');
|
|
|
|
var response_type = getUrlParameter('response_type');
|
|
|
|
var state = getUrlParameter('state');
|
|
|
|
|
|
|
|
// Get DONOTSHARE-secretkey from localStorage
|
|
|
|
var secret_key = localStorage.getItem("DONOTSHARE-secretkey");
|
|
|
|
|
|
|
|
// Create data object to send
|
|
|
|
var data = {
|
|
|
|
client_id: client_id,
|
|
|
|
secretKey: secret_key,
|
|
|
|
state: state
|
|
|
|
};
|
|
|
|
|
|
|
|
// Send data to example.org using POST request
|
|
|
|
fetch("https://auth.hectabit.org/api/auth", {
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json"
|
|
|
|
},
|
|
|
|
body: JSON.stringify(data)
|
|
|
|
})
|
|
|
|
.then(response => {
|
2024-03-28 17:02:52 +00:00
|
|
|
console.log(response);
|
2024-03-28 17:07:30 +00:00
|
|
|
window.location.replace(redirect_uri + "?code=" + response + "&state=" + state)
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
alert("Error sending data: " + error.message);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|