Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
We have integrated Qlik Sense Hub into our application via Virtual Proxy with SAML based authentication.
I am able to log on to hub and able to view apps and do actions as per security rule perfectly good. Now when I logout on my application,I would like to logout the session from Qlik sense as well.
Is there any api that I can make use of to logout.
We also support multiple session for a single login. i.e., Same user can login from different location
How do I get to logout the user from Qlik in such cases?
Thanks
Hi Lars-Göran,
please have a look at this Support Case: 00891931 - Docu BUG for
I think that the Docu is wrong, if you check what the sense web client is doing.
1. this reflects in a wrong behauvior of the .NET SDK because you implemented this like documented
2. I found out it is even more easy
(location as IDisposable).Dispose() is doing at least since .NET SDK 3.0.1 the same thing, if it would implemented right.
ebiexperts you can not read the bug ticket, but the right order is:URL/virtualproxy/qps/user/
This is the new corrected function:
public static class LocationExtensions_akquinet
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public static bool LogoutUser(this ILocation location)
{
try
{
var serverPath = location.ServerUri.AbsoluteUri;
if (!string.IsNullOrEmpty(location.VirtualProxyPath))
serverPath += location.VirtualProxyPath+@"/";
var request = (HttpWebRequest)HttpWebRequest.Create(serverPath + @"qps/user");
request.CookieContainer = new CookieContainer();
foreach (var cookie in location.CustomUserCookies)
request.CookieContainer.Add(new Uri(serverPath), new Cookie(cookie.Key, cookie.Value));
var sc = location.SessionCookie().Split(new char[] { '=' });
request.CookieContainer.Add(new Uri(serverPath), new Cookie(sc[0], sc[1]));
request.Method = "DELETE";
request.GetResponse();
return true;
}
catch (Exception ex)
{
logger.Info(ex);
return false;
catch (Ex
}
}
}
bye Konrad
Hi Lars,
I have used qps personal api (https://help.qlik.com/en-US/sense-developer/2.0/Subsystems/ProxyServiceAPI/Content/ProxyServiceAPI/P...) and called /{virtual proxy}/qps/user after setting the cookie named which is set up in the virtual proxy (X-Qlik-Session).
Its tearing down all sessions of the user and behaving like Logout API (https://help.qlik.com/en-US/sense-developer/2.0/Subsystems/ProxyServiceAPI/Content/ProxyServiceAPI/P...)
I don;t have session Id of the user and can not call the session module API to tear down the specific user session.
Can you help me with this. I just want to terminate the particular session.
Hi,
there is no API to delete thru the Proxy. If you want to delete specific session you will have to write a component or service that is in the trusted zone and call DELETE on the following endpoint qps/{virtualproxy}/session/{id} (port 4243). {id} should contain the session cookie header (X-Qlik-Session). Not if you are using load balancing you will need to call all nodes.
To write a component or service that is in the trusted zone see ConnectDirect* examples on GitHub - AptkQlik/PublicExamples
Best regards
Lars-Göran Book
Awesome !!! Thanks a lot.
I wasn't aware that {id} can be the session cookie header (X-Qlik-Session). Its not mentioned in the documentation.
Thanks
-Vishal
Hi Vishal,
please raise a docu bug against qlik so this can be fixed in the documentation.
Even if this is work, it will help a lot of programmers after you.
bye Konrad
Sure konrad.mattheis , I will do that,
My portal and qlik are running on different sub domains and this is restricting me from accessing the qlik cookie. Need to figure out some alternate method now.
Hi Konrad,
Does this function prevent you from LicenseAccessDenied exception? I'm still getting error after 5 connections to API.
Many thanks!
BRs,
Michal