Source code

Revision control

Copy as Markdown

Other Tools

// receive token from the parent window, set cookie and notify parent
window.addEventListener("message", ({ origin, data }) => {
if (origin !== "http://localhost:8000") {
return;
}
document.cookie = `token=${data}; SameSite=Strict`;
window.parent.postMessage("", "http://localhost:8000");
});