<iframe src="https://sandbox.etherfuse.com/auth/launch"></iframe>
<script>
const origin = "https://sandbox.etherfuse.com";
window.addEventListener("message", (event) => {
if (event.origin !== origin) return;
if (event.data?.type !== "etherfuse:auth:request") return;
// event.source is the launch iframe; reply to it.
event.source.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
origin,
);
});
</script>
// Open WITHOUT noopener so the window keeps `window.opener` and can
// postMessage back to your page.
const launcher = window.open("https://sandbox.etherfuse.com/auth/launch", "etherfuse");
window.addEventListener("message", (event) => {
if (event.origin !== "https://sandbox.etherfuse.com") return;
if (event.data?.type !== "etherfuse:auth:request") return;
launcher.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
event.origin,
);
});
Authentication
Launch a user via postMessage
⚠️ Different host. Like POST /auth/launch, this lives on the app host (
app.etherfuse.comorsandbox.etherfuse.com), not the API host. It is a browser page, not a JSON API.
Use this variant of launch to embed the flow in an iframe or popup. Open /auth/launch with no body. The page asks your page for credentials over postMessage, and you reply. Use it when you don’t want to render a form POST on your server. It also lets you handle an expired session and launch into a different target without a redirect page.
postMessage contract
- When it loads, the launch page posts an
etherfuse:auth:requestmessage to your page. - Your page replies with an
etherfuse:auth:responsethat has the fields below. - If you need a moment to sign a JWT, send
etherfuse:auth:awaitfirst so the page doesn’t time out.
Fields
grant_typeandassertion: a partner JWT (grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer), or arefresh_tokenfrom an earlier server-side exchange (grant_type=refresh_token).target: the app path to open. It must be an allowed target. See User Launch Flows. We reject any other path.return_url(optional): where we send the user when they leave.
The JWT’s sub and scope follow the same rules as POST /auth/launch.
GET
/
auth
/
launch
<iframe src="https://sandbox.etherfuse.com/auth/launch"></iframe>
<script>
const origin = "https://sandbox.etherfuse.com";
window.addEventListener("message", (event) => {
if (event.origin !== origin) return;
if (event.data?.type !== "etherfuse:auth:request") return;
// event.source is the launch iframe; reply to it.
event.source.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
origin,
);
});
</script>
// Open WITHOUT noopener so the window keeps `window.opener` and can
// postMessage back to your page.
const launcher = window.open("https://sandbox.etherfuse.com/auth/launch", "etherfuse");
window.addEventListener("message", (event) => {
if (event.origin !== "https://sandbox.etherfuse.com") return;
if (event.data?.type !== "etherfuse:auth:request") return;
launcher.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
event.origin,
);
});
<iframe src="https://sandbox.etherfuse.com/auth/launch"></iframe>
<script>
const origin = "https://sandbox.etherfuse.com";
window.addEventListener("message", (event) => {
if (event.origin !== origin) return;
if (event.data?.type !== "etherfuse:auth:request") return;
// event.source is the launch iframe; reply to it.
event.source.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
origin,
);
});
</script>
// Open WITHOUT noopener so the window keeps `window.opener` and can
// postMessage back to your page.
const launcher = window.open("https://sandbox.etherfuse.com/auth/launch", "etherfuse");
window.addEventListener("message", (event) => {
if (event.origin !== "https://sandbox.etherfuse.com") return;
if (event.data?.type !== "etherfuse:auth:request") return;
launcher.postMessage(
{
type: "etherfuse:auth:response",
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: SIGNED_JWT,
target: "/kyb",
},
event.origin,
);
});
Response
302
We send the browser to the app page that asks your page for credentials over postMessage, signs the user in, and opens target.