MDN self-hosted library · e01.org

RTCPeerConnection: idpLoginUrl property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const pc = new RTCPeerConnection();
pc.setIdentityProvider("login.example.com");

pc.getIdentityAssertion().catch((error) => {
  if (pc.idpLoginUrl) {
    console.log(`IdP login required at: ${pc.idpLoginUrl}`);
    // Open the login page in a popup window
    const loginWindow = window.open(
      pc.idpLoginUrl,
      "idp-login",
      "width=500,height=600",
    );
  } else {
    console.error("Identity assertion failed:", error);
  }
});