Client ID assigned to your application on
https://developer.audiotool.com/applications. Must have an origin
matching targetOrigin registered in its redirect URIs.
OAuth scopes (e.g. "project:write").
OptionaltargetOrigin?: stringThe 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?: stringFeatures string passed to window.open().
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)
}
}
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.