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

# Launching the pre-built UI

> Use the Authsignal Web SDK to launch the pre-built UI.

The Web SDK can be used to [launch the pre-built UI](/implementation-options/prebuilt-ui/presentation-modes).

<CodeGroup>
  ```js Popup theme={null}
  const result = await authsignal.launch(url, {
    mode: "popup",
  });
  ```

  ```js Redirect theme={null}
  authsignal.launch(url, {
    mode: "redirect",
  });
  ```

  ```js Window theme={null}
  const result = await authsignal.launch(url, {
    mode: "window",
  });
  ```
</CodeGroup>

### Parameters

<ResponseField name="url" type="string">
  The URL obtained on your server by [tracking an
  action](/implementation-options/prebuilt-ui/overview#1-backend-track-action).
</ResponseField>

<ResponseField name="options" type="LaunchOptions Object">
  The options used when launching the pre-built UI.

  <Expandable>
    <ResponseField name="mode" type="popup | redirect | window">
      How the pre-built UI should launch: `popup` opens it in an overlay, `window` opens it in a
      separate browser window, and `redirect` triggers a full page redirect. If no value is supplied,
      mode defaults to `redirect`.
    </ResponseField>

    <ResponseField name="popupOptions" type="Object">
      Only available when `mode` is `popup`.

      <Expandable defaultOpen>
        <ResponseField name="width" type="string">
          Any valid CSS value for the `width` property.
        </ResponseField>

        <ResponseField name="height" type="string">
          Any valid CSS value for the `height` property. If not set, the popup will auto-adjust to
          the height of the content.
        </ResponseField>

        <ResponseField name="isClosable" type="boolean">
          Whether the popup is closable with the escape key and by clicking the backdrop.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="windowOptions" type="Object">
      Only available when `mode` is `window`.

      <Expandable defaultOpen>
        <ResponseField name="width" type="number">
          The width of the window in pixels.
        </ResponseField>

        <ResponseField name="height" type="number">
          The height of the window in pixels.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="onError" type="function">
      Called when an unexpected API error occurs in the pre-built UI. Available when `mode` is
      `popup` or `window`.

      <Expandable defaultOpen>
        <ResponseField name="errorCode" type="string">
          The error code returned by the API.
        </ResponseField>

        <ResponseField name="statusCode" type="number">
          The HTTP status code of the failed request.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

### Response

<ResponseField name="Promise<TokenPayload>">
  When `mode` is set as `popup` or `window` it returns a `Promise<TokenPayload>` that resolves when the popup or window closes.

  <Expandable defaultOpen>
    <ResponseField name="token" type="string">
      The token that can be used to verify the outcome of the user action.
    </ResponseField>
  </Expandable>
</ResponseField>

For more information on launching the pre-built UI see our [detailed guide](/implementation-options/prebuilt-ui/presentation-modes).
