Build a "Log Out" button directly in your QlikView applications!
Whether you want to repackage your BI solution or simply create a one-click experience, it is quite common to bypass the QlikView AccessPoint by providing users with a direct link to a particular application. For security or convenience reasons, it is often a good idea to allow users to log out of the application when they are finished using it. To date, the only way to achieve such a logout was to use a Single Sign On (SSO) solution to authenticate your users and then link to an external "logout" file via an "Open URL" action in QlikView. Using the below code, we can achieve the same thing using QlikView's own native forms-based authentication.
Step 1: Enable Login Authentication
If you are starting with the default QlikView configuration, you will need to begin by changing the default authentication type that QlikView uses from Browser to Web Form:
It may seem obvious, but in order for users to be able to log out, they must first be able to log in. The default authentication mode uses your Windows authentication token; since that type of authentication occurs at the IIS level, a logout is not possible programmatically. When you switch QlikView to use Web Form authentication, users will be presented with the following screen when they try to open either the AccessPoint or their specific application via a direct link:
In addition, the following Sign Out link becomes available in the AccessPoint header:
Step 2: Download New Files
Download and extract the above ZIP file. Copy the file logout.htm to your Web folder (default path: C:\Program Files\QlikView\Web). Copy the file LogoutExample.qvw to your AccessPoint folder structure
Step 3: Modify accessPoint.js
Search for the next instance of "teardown" which should appear at approximately line 1130, but may again vary depending on your QlikView version. Replace the entire function that currently reads:
Save and close the file. The ZIP file includes an example of a modified accessPoint.js. Please use this file as a reference only; because it was created using an 11.20 SR8 base file, I do not recommend that it be used to overwrite accessPoint.js on any machines running other service releases.
Step 4: Modify opendoc.htm
Navigate to your QlikViewAjax folder (default path: C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax). Open the file opendoc.htm in a text editor (create a backup of this file prior to modifying it). Immediately before the concluding </head> tag, paste the following code snippet:
Save and close the file. The ZIP file includes an example of a modified opendoc.htm. Please use this file as a reference only; because it was created using an 11.20 SR8 base file, I do not recommend that it be used to overwrite opendoc.htm on any machines running other service releases.
Step 5: Open LogoutExample.qvw
Open the AccessPoint, log in, and open the LogoutExample.qvw application. This application includes 4 examples of different log out methods you can implement. Choose the one most appropriate to your situation, and deploy!
Please leave comments with suggestions, success stories, or innovative ways you've been able to use the solutions described in this article! And, as always, happy Qliking!