Welcome to Zuora Product Documentation

Explore our rich library of product information

Implement the Mylo logout flow

Implement the Mylo logout flow using Zephr configuration and redirect URLs.

  1. Send a logoutConfig GET request to Zephr.
  2. Receive the response from Zephr containing:
    • clientId

    • logoutRedirectUrl

  3. Use the returned parameters to construct the Mylo logout link.
  4. When the user selects the Mylo logout link, send a GET request to Mylo with:
    • client_id

    • logout_uri

  5. Mylo processes the logout request.
  6. Mylo sends a request to Zephr using logoutRedirectUrl.
  7. Zephr redirects the user to endingUrl.
  8. Delete the Zephr session cookie and reload the page.

    Mylo Logout Example

    <div id="mylo-logout-link">Loading Mylo Sign Out link...</div>
    <script>
     function logoutConfig() {
     var client = new (XMLHttpRequest || ActiveXObject)("MSXML2.XMLHTTP.3.0");
     client.open("GET", `/plugins/public/mylo/logoutConfig`, null);
     client.onload = function () {
         if (client.status === 200) {
         var response = JSON.parse(client.responseText);
         document.getElementById("mylo-logout-link").innerHTML =
         '<a href="https://ciam-ui.kubestage.hearstapps.net/logout?client_id=' +
         response.clientId +
         "&logout_uri=" +
         encodeURIComponent(
         response.logoutRedirectUrl +
         `?endingUrl=${window.location.href}?logout=true`
         ) +
         '">Sign Out</a>';
         } else {
         console.log("can not fetch logout config");
         document.getElementById("mylo-logout-link").innerHTML =
         "can not get Mylo Sign Out link";
         }
     };
     client.setRequestHeader("Content-type", "application/json");
     client.withCredentials = true;
     client.send();
    }
    logoutConfig();
    function destroyCookie() {
     var isLogout,
         tmp = [];
     var items = window.location.search.substr(1).split("&");
     for (var index = 0; index < items.length; index++) {
         tmp = items[index].split("=");
         if (tmp[0] === "logout") {
         isLogout = decodeURIComponent(tmp[1]);
         break;
         }
     }
     var cookieName = "blaize_session";
     if (isLogout) {
         console.log("deleting cookie " + cookieName + "...");
         document.cookie = cookieName + "=; Max-Age=-99999999;path=/";
         window.location.reload();
     } else {
         console.log("do nothing with cookie " + cookieName);
     }
    }
    destroyCookie();
    </script>