> ## Documentation Index
> Fetch the complete documentation index at: https://docs.etherfuse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Launch a user via postMessage

> > ⚠️ **Different host.** Like [POST /auth/launch](/api-reference/authentication/launch-a-user-into-the-app), this lives on the **app host** (`app.etherfuse.com` or `sandbox.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](/api-reference/authentication/launch-a-user-into-the-app) on your server. It also lets you handle an expired session and launch into a different target without a redirect page.

## postMessage contract

1. When it loads, the launch page posts an `etherfuse:auth:request` message to your page.
2. Your page replies with an `etherfuse:auth:response` that has the fields below.
3. If you need a moment to sign a JWT, send `etherfuse:auth:await` first so the page doesn't time out.

## Fields

- **`grant_type`** and **`assertion`**: a partner JWT (`grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer`), or a `refresh_token` from an earlier [server-side exchange](/api-reference/authentication/exchange-a-partner-jwt) (`grant_type=refresh_token`).
- **`target`**: the app path to open. It must be an allowed target. See [User Launch Flows](/guides/user-launch-flows#targets). 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](/api-reference/authentication/launch-a-user-into-the-app).

```html iframe theme={null}
<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>
```

```javascript window.open theme={null}
// 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,
  );
});
```


## OpenAPI

````yaml https://api.etherfuse.com/openapi-v2.json GET /auth/launch
openapi: 3.1.0
info:
  title: Etherfuse FX API
  description: >-
    Partner-facing ramp API, version 2: payment accounts, quotes, orders and
    webhooks.
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api.sand.etherfuse.com
    description: Sandbox
security:
  - ApiKeyAuth: []
tags:
  - name: Payment Accounts
    description: >-
      Register the bank accounts and wallets that money moves from and to, and
      read their readiness per rail.
  - name: Quotes
    description: Price a transfer between two registered payment accounts.
  - name: Orders
    description: Create orders from quotes and track them.
  - name: Webhook Subscriptions
    description: Subscribe to webhook events.
  - name: Webhook Events
    description: Payloads Etherfuse sends to your webhook subscriptions.
  - name: Sandbox
    description: Endpoints that work only in sandbox, for testing.
  - name: Assets
    description: The markets and tokens a quote can use, and the balances of a wallet.
  - name: Authentication
    description: >-
      Partner JWT authentication: exchange a JWT for an access token, or launch
      a user into the app.
  - name: KYC
    description: >-
      Submit a customer's verification data, documents and questionnaire
      answers, import a verification they already passed elsewhere, and check
      where their KYC stands.
  - name: KYB
    description: Check where a business organization's KYB stands.
  - name: Lookup
    description: >-
      Public reference data: exchange rates, stablebonds, bond costs, country
      codes.
  - name: Organizations
    description: >-
      Your organization, your default partner fee, and the customer
      organizations you create.
  - name: Members
    description: >-
      The people who belong to a customer business organization and complete its
      KYB.
  - name: Statements
    description: >-
      Monthly revenue share statements for closed months, as a list or as a CSV
      or PDF download.
paths:
  /auth/launch:
    servers:
      - url: https://sandbox.etherfuse.com
        description: Sandbox app host, not the API host
    get:
      tags:
        - Authentication
      summary: Launch a user via postMessage
      description: >-
        > ⚠️ **Different host.** Like [POST
        /auth/launch](/api-reference/authentication/launch-a-user-into-the-app),
        this lives on the **app host** (`app.etherfuse.com` or
        `sandbox.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](/api-reference/authentication/launch-a-user-into-the-app) on your
        server. It also lets you handle an expired session and launch into a
        different target without a redirect page.


        ## postMessage contract


        1. When it loads, the launch page posts an `etherfuse:auth:request`
        message to your page.

        2. Your page replies with an `etherfuse:auth:response` that has the
        fields below.

        3. If you need a moment to sign a JWT, send `etherfuse:auth:await` first
        so the page doesn't time out.


        ## Fields


        - **`grant_type`** and **`assertion`**: a partner JWT
        (`grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer`), or a
        `refresh_token` from an earlier [server-side
        exchange](/api-reference/authentication/exchange-a-partner-jwt)
        (`grant_type=refresh_token`).

        - **`target`**: the app path to open. It must be an allowed target. See
        [User Launch Flows](/guides/user-launch-flows#targets). 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](/api-reference/authentication/launch-a-user-into-the-app).
      operationId: auth_launch_postmessage
      responses:
        '302':
          description: >-
            We send the browser to the app page that asks your page for
            credentials over `postMessage`, signs the user in, and opens
            `target`.
      security: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API key sent in the Authorization header, with no `Bearer` prefix.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.