Support Article
Browser session times out after 29 minutes with a blank popup
SA-101911
Summary
Okta session times out after a browser idle time (29/30min). On clicking the browser popup to continue the session, two options display,
- Continue session normally
- Disconnect session and prompt Okta login screen
The second option which disconnects the session, displays a blank popup window.
Error Messages
Not Applicable
Steps to Reproduce
- Implement Single Sign-on (SSO) with OKTA.
- Set the Timeout value in the Advance tab of the Access Group. After timeout, a blank screen displays.
Root Cause
A defect in Pegasystems’ code or rules.
Resolution
Perform the following local-change:
- Copy the pxSessionTimer Section rule to an Application ruleset and rename it to SessionTimer<AppName>.
- Update the SessionTimer<AppName> and add all the contents of the script (code present at the end of this Support Article) to the existing Script block before the ending </script> tag (Add the code provided. Do not remove the existing code).
- Add the SessionTimer<AppName> section to the portal Header which is pyPortalHeader by default. This does not occupy space. Do not add this in areas where dynamic content is present. A Parameter page is present for the SessionTimer<AppName> once it is added. This allows the user to control the Timeout and Warning values. The 'Show Authentication screen' in the Parameter settings has no functionality with this code and is always an Inline modal Div.
- Test this by launching the User portal from the Pega Developer portal. The lowest combination that the user can test with for Timeout and Warning is 3 and 1. This is due to how the Warning timer works.
With a three minute Timeout and a one minute Warning, the Logoff countdown timer displays after two minutes with a one minute Countdown. When the Countdown reaches 0, the Logoff code is triggered. When launched from a Developer portal, the window containing the User portal closes. Logoff does not occur.
- Remove the existing Timeouts.
Once testing is completed, Pega Timeout value configured in the user's AccessGroup is not required. Remove the value and update the AccessGroup.
When using SSO, ensure to test with an SSO login before navigating out of Devlopment or Testing to Production.
Note: Adjust the Timeout and Warning values to the required Timeout values.
Below is the code that must be included:
console.log("clearing timer [load]: " + pega.desktop.TimeoutWarningCountdown);
clearTimeout(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);
clearTimeout(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);
}
}
}
function desktop_showTimeoutLogoffDialogNew(strTime, timerID) {
if (timerID == currentTimerRandID){
var iTime = parseInt(strTime);
iTime = iTime * 60000;
var oSafeURL = new SafeURL("@baseclass.ShowLogoffTimer");
oSafeURL.put("time",iTime);
/*pega.openUrlInModal.showModalDialog*/
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");
desktop_restartTimeoutWarningTimer();
} else {
pega.u.d.gDirtyOverride = false;
closeAllPRPCChildWindows();
try {
application.logOff(true);
} 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);
*/
}
else{
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="https://community.pega.com/%27%20%2B%20%28%20typeof%20url%20%3D%3D%20"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");
$frame.children().on("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;
dialogWindow.dialog('destroy');
frame.remove();
dialogWindow.remove();
if( callbackFunction) {
try {
callbackFunction(window.returnValue);
} catch(e) {
alert("pega.openUrlInModal.showModalDialog - error when calling callbackfunction: '" +e.message + "'");
}
}
}
/*
Close all windows opened by standard UI calls using pega ui api.
If you coded your own window.open ... close it yourself ;)
*/
function closeAllPRPCChildWindows() {
var currWin = null;
var app = pega.desktop.support.getDesktopApplication();
while (null != (curWin = app.openedWindows.pop())) {
curWin.close();
}
}
Published April 1, 2020 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.