@audiotool/nexus - v0.0.17
    Preparing search index...

    Function audiotoolPopup

    • Authenticate via a window.open() popup and postMessage. Use this when your app runs in an iframe or otherwise cannot do a full-page redirect.

      Must be called synchronously from a click (or other user-gesture) handler, otherwise the browser's popup blocker will reject the window.open() call.

      Parameters

      • __namedParameters: {
            clientId: string;
            scope: string;
            targetOrigin?: string;
            windowFeatures?: string;
        }
        • clientId: string

          Client ID assigned to your application on https://developer.audiotool.com/applications. Must have an origin matching targetOrigin registered in its redirect URIs.

        • scope: string

          OAuth scopes (e.g. "project:write").

        • OptionaltargetOrigin?: string

          The origin the popup will postMessage the result to. Defaults to window.location.origin. The accounts service validates this against the client's registered redirect-uri origins.

        • OptionalwindowFeatures?: string

          Features string passed to window.open().

      Returns Promise<PopupAuthResult>

      import { audiotoolPopup } from "@audiotool/nexus"

      button.onclick = async () => {
      const at = await audiotoolPopup({
      clientId: "your-client-id",
      scope: "project:write",
      })

      if (at.status === "authenticated") {
      const projects = await at.projects.listProjects({})
      } else {
      console.error("Login failed:", at.error)
      }
      }