This guide shows how to sign users in and out using a popup window instead of a full-page redirect.
If your app runs inside an iframe, popup mode is required — redirect sign-in and sign-out throw aMonoCloudJsErrorbecause MonoCloud's sign-in and end-session pages cannot be displayed in a framed context.
signIn({ mode: "popup" })signOut({ mode: "popup" })This guide assumes you've completed the JavaScript quickstart or the installation guide.
You should already have:
@monocloud/auth-web-js SDK installedMonoCloudWebJSClient initializedPass { mode: "popup" } to keep the user on the current page while authentication happens in a popup window.
await client.signIn({ mode: "popup" });
How it works:
signOut() accepts the same mode option as signIn(). Popup sign-out is useful when you want to end the session without navigating away from the current page.
await client.signOut({ mode: "popup" });
Override the popup size on the client if the defaults don't suit your sign-in screens:
import { MonoCloudWebJSClient } from "@monocloud/auth-web-js";
export const client = new MonoCloudWebJSClient({
tenantDomain: "https://<your-domain>",
clientId: "<your-client-id>",
popupWindowWidth: 480,
popupWindowHeight: 700,
});