Jeremy Patrick Pacabis (Jer)
02/08/2024, 10:04 AMlisteningForApiToken
message or even the event being transmitted from the iframe with the ?apiTokenAuthentication=true
url. I'm using the analyticalDesigner
product that's been embeddedJan Kos
02/12/2024, 9:49 AMJeremy Patrick Pacabis (Jer)
02/13/2024, 3:00 AM<html>
<head></head>
<script>
console.log("Setup parent frame message listener")
const token = `token here`
document.addEventListener(
"message",
function (event) {
console.log("Post message received", event);
if (event.data.gdc?.event.name === "listeningForApiToken") {
const postMessageStructure = {
gdc: {
product: "analyticalDesigner",
event: {
name: "setApiToken",
data: {
token,
}
}
}
};
console.log("Sending token to embedded window");
const origin = "*";
const iframe = document.getElementById("aa1KcXTXbio1-insights-editor").contentWindow;
iframe.postMessage(postMessageStructure, origin);
}
},
false
);
</script>
<body>
<iframe id="aa1KcXTXbio1-insights-editor"
src="<https://agency-spotter-dev.on.gooddata.com/analyze/embedded/#/${projectId}/reportId/edit?apiTokenAuthentication=true>"
width="100%"
height="100%"
></iframe>
</body>
</html>
Jeremy Patrick Pacabis (Jer)
02/13/2024, 3:00 AMJeremy Patrick Pacabis (Jer)
02/13/2024, 3:01 AMJan Kos
02/13/2024, 8:32 AM