Skip to main content

Support Article

SAML/SSO timeout-does-not-redirect-login-page



Implemented a solution recommended by a support article to have the user redirected to the login page upon timeout. However, it is un-authenticating the user, but not redirecting them to the login page.

Followed the directions per this support article:

Error Messages

The content cannot be displayed in a frame.

Steps to Reproduce

1. Have Timeout setting is set as 60 seconds (example) in Access Group
2. Login to system by using the SSO URL
3. After 2 mins system the user is still in interaction portal

4a. It Is taking the user back to login only after hitting the refresh icon in the browser.
4b. If user clicks anywhere on the UI after being unauthenticated, an error displays.

Root Cause

The PDN support article is for handling timeouts and reauthentication and not showing the logoff timer.


Client is using CRM and requires special JQuery version of sessiontimer so modal window closes and logoff occurs properly.

1) Copy pxSessionTimer to application ruleset and rename to SessionTimer<AppName>

2) Replace <script></script> block with the following

pega.d.TimeoutTime = '<%=pyTimeoutTime%>';
pega.d.TimeoutWarningWindow = '<%=pyTimeoutWarningWindow%>';
pega.d.TimeoutPopuptype = '<%=pyTimeoutPopupType%>';
pega.d.TimeoutPopupHeight = "<pega:lookup className="Rule-Obj-FieldValue" property="pyLocalizedValue"><pega:key name="pyClassName" value ="Rule-Portal" /><pega:key name="pyFieldName" value="pyTimeoutPopupType" /><pega:key name="pyFieldValue" value="WindowHeight" /></pega:lookup>";
pega.d.TimeoutPopupWidth = "<pega:lookup className="Rule-Obj-FieldValue" property="pyLocalizedValue"><pega:key name="pyClassName" value ="Rule-Portal" /><pega:key name="pyFieldName" value="pyTimeoutPopupType" /><pega:key name="pyFieldValue" value="WindowWidth" /></pega:lookup>";
pega.d.TimeoutWarning = '<%=warningMsg%>';

if (pega.d.TimeoutWarningCountdown != null) {
console.log("clearing timer [load]: " + pega.desktop.TimeoutWarningCountdown);
console.log("onload inline setting timer to null");
pega.d.TimeoutWarningCountdown = null;
currentTimerRandID = null;

function desktop_restartTimeoutWarningTimer(){
if (pega.desktop.TimeoutTime && pega.desktop.TimeoutTime > 0) {
var nTimeoutWarningTime= (pega.desktop.TimeoutTime - pega.desktop.TimeoutWarningWindow) * 60000;
console.log("clearing timer: " + pega.desktop.TimeoutWarningCountdown);
pega.desktop.TimeoutWarningCountdown = null;

if (nTimeoutWarningTime >= 0) {
currentTimerRandID = Math.floor(100000 + Math.random() * 9000000);
console.log("currentTimerRandID: "+ currentTimerRandID);
pega.d.TimeoutWarningCountdown = self.setTimeout("desktop_showTimeoutLogoffDialogNew('"+pega.d.TimeoutWarningWindow +"','"+currentTimerRandID+"')",nTimeoutWarningTime);
console.log("created timer: " + pega.desktop.TimeoutWarningCountdown);
* Shows user a warning when their session is about to timeout so they can have the option to
* extend their session. Logs the user off if they do not extend.
* @return $void$
function desktop_showTimeoutLogoffDialogNew(strTime, timerID) {
if (timerID == currentTimerRandID){

var iTime = parseInt(strTime);
iTime = iTime * 60000;
var oSafeURL = new SafeURL("@baseclass.ShowLogoffTimer");
console.log("displaying logoff timer");
showJqueryModalDialog(oSafeURL,iTime, 210, 420, function(ret){
if (ret == null || ret == "ok") {
console.log("calling desktop_restartTimeoutWarningTimer from OK response from modal");
} else {
pega.u.d.gDirtyOverride = false;
try {
} catch(e) {
pega.u.d.replace('pyActivity=LogOff&pzPrimaryPageName=pyDisplayHarness', null);
/* This is not needed, was put in for testing lower timeout values
self.setTimeout(function(){console.log("clearing timer while modal displays");clearTimeout(pega.desktop.TimeoutWarningCountdown);}, 5000);
console.log("timerID: "+ timerID + " did not match currentTimerRandID: "+ currentTimerRandID);

/* display a modal dialog using jquery */
function showJqueryModalDialog(url, arDialogArguments, height, width, callbackFunction ) {
if(arDialogArguments) window.dialogArguments = arDialogArguments;
var $frame = $('<div><iframe name="pzDisplayModalDialog" id="pzDisplayModalDialog" frameborder="0" src=""string" ? url : url.toURL() ) + '" style="width:100%; height:100%"/></div>');
var $dialogWindow = $frame.dialog({
autoOpen: true,
modal: true,
width: width,
height: height+50,
resizable: false,
autoResize: false,
overlay: {
opacity: 0.8,
background: "black"
open: function() {
pzDisplayModalDialogWindow = $(this).children()[0].contentWindow;
if(window.gsServerReqURI) pzDisplayModalDialogWindow.gsServerReqURI = window.gsServerReqURI;
pzDisplayModalDialogWindow.dialogArguments = window.dialogArguments;
pzDisplayModalDialogWindow.returnValue = undefined;
close: function() {
handleCloseJqueryModal( callbackFunction, undefined , $frame, $dialogWindow);
}).width(width-30).height(height).css("overflow", "hidden");
// PRPC 7.3.1 and later:
//$frame.children().on("load", function() {
//Prior to PRPC 7.3.1
$frame.children().load(function() {
var title = $(this).contents().find("title").html();
$dialogWindow.dialog('option', 'title', title);
pzDisplayModalDialogWindow = $(this)[0].contentWindow;
pzDisplayModalDialogWindow.closeModal = function() {
handleCloseJqueryModal( callbackFunction, pzDisplayModalDialogWindow.returnValue, $frame, $dialogWindow );

function handleCloseJqueryModal( callbackFunction, retval, frame, dialogWindow ) {
window.returnValue = retval;
if( callbackFunction) {
try {
} catch(e) {
alert("pega.openUrlInModal.showModalDialog - error when calling callbackfunction: '" +e.message + "'");


Suggest Edit

Published February 13, 2018 - Updated October 8, 2020

Did you find this content helpful? Yes No

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us