Iframe embedding

The editor is embeddable in iframe too, using /auth-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/token-auth/<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);
    });
  
Session started
{
    "type": "sessionStarted",
    "sessionId": "xxx", // id of the session that just started
    "initToken": "<token>" // the JWT sent to authenticate the current session /token-auth/{token}
}    
Session ended
{
    "type": "sessionEnded",
    "sessionId": "xxx", // id of the session that just finished
}    

Last updated