burgerauth/static/js/aeskeyshare.js

17 lines
537 B
JavaScript
Raw Normal View History

2024-04-29 21:18:46 +01:00
// Add an event listener to handle incoming messages
window.addEventListener("message", function(event) {
2024-04-29 21:18:46 +01:00
const access_token = event.data;
2024-04-29 21:28:18 +01:00
fetch("https://auth.hectabit.org/api/loggedin", {
2024-04-29 21:18:46 +01:00
method: "POST",
body: JSON.stringify({
access_token: access_token
})
2024-04-29 21:18:46 +01:00
})
.then((response) => function () {
if (response.status === 200) {
console.log("Key is valid")
window.postMessage(localStorage.getItem("DONOTSHARE-password"), event.origin)
}
})
});