Logging Out of QlikView Apps

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
Navigate to your Web\js folder (default path: C:\Program Files\QlikView\Web\js). Open the file accessPoint.js in a text editor (create a backup of this file prior to modifying it). I recommend running it through a JavaScript beautifier to make the file easier to read. Search for the word "teardown" which should first appear at approximately line 750, but may vary depending on your QlikView version. Replace the line that reads:

with:

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:

with:

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!
This entry was posted in Security, Server, Tips & Tricks and tagged , , , , , , . Bookmark the permalink.

17 Responses to Logging Out of QlikView Apps

  1. JV says:

    Hi,

    Very good post. However, it’s good to remember that Qlik won’t provide support if we change anything to the files.

    That’s why I’ve created a document extension to terminate the Ajax session when you close your browser window or tab as the users never bother to click “log out”.

    You can find it here if it’s of any use to you.

    biexperience.wordpress.com (Close Document Session)

    Best
    JV

    • Also a valid solution, though one that really does something else entirely (and only works with Ajax). Thanks for sharing.

      Vlad

    • Also, as far as support goes, you may be right but I don’t really view that as much of a problem. First of all, of the dozens of times I’ve had to contact Qlik support, they’ve never actually fixed the problem I was experiencing. Not once. I’ve always had to fix unique problems with hacks of my own (such as this one). Plus, ever since they’ve gone public, support has degraded to the point where it’s basically completely useless. Finally, at the end of the day, if you do really need support, just undo the couple lines of changes to accessPoint.js for purposes of the support case.

      • JV says:

        I totally agree with you. And it’s not that I haven’t change Access Point but readers should know just in case. Access point is not customizable at all. They should put an interface so it’s easy for everybody to change and still provide support.

        Thanks for your insight.

        jv

  2. Update: Added a fix on November 3rd for Safari (in particular, Safari on iPad).

  3. Teodora says:

    Hi, i try to do this in my application but it doesn`t work. Is it posible to give me your email to discus where i am in wrong 🙂 Have a nice day.

    • Teodora, rather than troubleshooting over email (where only you and I can see the solution), let’s discuss here so that it might help everyone. What’s the problem you’re experiencing?

      Vlad

  4. Bob Marino says:

    Hi, thanks for the tutorial. I followed the steps above and when I open access point I have to authenticate twice. The first looks like it’s coming from IIS, then I get the QlikView sign in page where I have to authenticate again. I have my IIS authentication settings set for Windows Authentication. Should I be using another authentication method?

    Thanks,
    Bob

    • Hi, Bob. When you switch to QlikView’s native forms authentication method, you need to enable Anonymous Authentication on the QlikView and QvAjaxZfc virtual applications in IIS. Or yes, users who are currently accessing QlikView from outside your domain will have to login twice, but that might defeat the purpose.

      Regards,
      Vlad

  5. Stewart Plumb says:

    I went through the steps but when I open the logout example and try any of the four examples I get a login failed error and it allows me to use the back button to access the previous application. Is there something else that needs to be added?

    • Hi, Stewart. I suspect the issue is that you need disable Windows Authentication and enable Anonymous Authentication in IIS on the QlikView and QvAjaxZfc virtual applications.

      Regards,
      Vlad

  6. Zhihong says:

    Hi, Vlad, thanks for your post. I am trying to implement your solution. But I am stuck at the “sign in” page, there is no “submit” button in my chrome, firefox. I am wondering there the FormLogin.htm in path C:\Program Files\QlikView\Web is used, because I check it, and the FormLogin.htm seems correct. Do you have any idea why?
    Thanks,
    Zhihong

    • If your FormLogin.htm was missing a submit button before you even began modifying it, perhaps your QlikView installation is corrupt. Try doing a repair installation. Otherwise, check your browser settings. Not sure what else to suggest.

      Vlad

  7. Update: for QlikView v12.10, change the JavaScript include path on line 10 of logout.htm to js/jquery.min.js

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify via email when new comments are added

Blog Home
Categories
Archives