Iframe
For a strict CSP or a CMS that will not take custom elements. The onboarding exchange is the same as the web component's — you send us your domain, wallet base URL and service key; we answer with your tenant UUID — but here your system stores the UUID and sends it on every embed: inside an iframe the Origin we see is our CDN's, not your domain, so the UUID is what names you.
<iframe
src="https://cdn.example.com/sportsbook-embed.html?tenantId=<your UUID>&origin=https://casino.example.com"
style="width:100%;height:100vh;border:0"
></iframe>
Three query parameters, no more:
| Parameter | |
|---|---|
tenantId | Required. Your tenant UUID. |
authToken | The player's session token. Prefer posting it (below) so it never lands in a URL — you have ~1.5s from load before the widget reports the session missing. |
origin | The exact origin of your page. It scopes every message we post. Defaults to *; set it. |
If you run a CSP, allow frame-src https://{cdn} — the sportsbook's own
traffic happens inside the frame and needs nothing from your policy.
Messages
Sign-in and sign-out post the token into the frame; every widget event comes back out the same way:
window.addEventListener('message', (e) => {
if (e.origin !== 'https://cdn.example.com') return;
if (e.data?.source !== 'sportsbook-widget') return;
console.log(e.data.type, e.data.detail);
});
iframe.contentWindow.postMessage(
{ source: 'sportsbook-host', type: 'set-auth-token', value: token },
'https://cdn.example.com',
);
One event behaves differently here.
sportsbook-session-expired arrives as a
message like every other, but nothing inside the frame acts on it: a frame
cannot navigate your page, so you decide where a player with no session
goes. Post a token with set-auth-token to sign them in without reloading the
frame — a frame that is never posted one reports reason: 'missing' and keeps
showing the catalog.
set-auth-token is the only inbound message; it is confirmed with
sportsbook-config-updated. When origin is set, inbound messages from any
other origin are ignored. Outbound you receive the same events the
web component dispatches, as { source: 'sportsbook-widget', type, detail } — except sportsbook-ready, whose
detail here is { ready: true }; the element itself cannot cross a frame.