Iframe embedding
The editor is embeddable in iframe too, using /tokenAuth?token=<token>
method. The only difference is that you use app-proxy.creatopy.com
subdomain instead app.creatopy.com
<iframe
title="Creatopy"
src="https://app-proxy.creatopy.com/tokenAuth?token=<token>"
style="width: 100%; border: none; min-height: 800px"
>
</iframe>
To ensure consistent integration, the iframe sends two messages to the parent window. One when the session starts and another when it ends, triggered by clicking the "End session" button.
You can catch the messages using the next script:
window.addEventListener("message", (event) => {
// Optionally, check the origin of the message for security purposes
if (event.origin !== "https://app-proxy.creatopy.com") return;
// Handle the message
console.log("Message received from iframe:", event.data);
});
{
"type": "sessionStarted",
"sessionId": "xxx", // id of the session that just started
"initToken": "<token>" // the JWT sent to authenticate the current session /token-auth/{token}
}
{
"type": "sessionEnded",
"sessionId": "xxx", // id of the session that just finished
}
Last updated