Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Josh_Rmg
Contributor II
Contributor II

.Net SDK - Multiple sessions using ApiKey connection?

Hi,

I have a ASP.Net Core web app, I am connecting to Qlik SaaS via an APIKey. (location.AsApiKey())

This is causing me an issue because I need each user to be able to apply a specific selection (using app.GetField().Select()) to the Qlik app so that they only see data relevant to them.

Since an APIKey is tied to a specific/single Qlik user account this means that each user of my web app will be applying different selections to the same user session which won't work. 

What is the best way to connect to a Qlik Saas app to allow each user to have their own session?

Is there a way to pass user accounts/details to Qlik SaaS?  or create a new session for each request to the API?

 

Apologies if I have made mistakes in my explanation/understanding, I am a junior dev!

 

Thanks,

Josh

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

An API key is strictly tied to a specific user, so if you authenticate using such a key, then you will end up as accessing the system as that user only. But you can still make multiple connections to Qlik SaaS that have independent sessions (or selection states if you like). You achieve this by specifying a session token in the second argument to  method IQcsLocation.App:

https://help.qlik.com/en-US/sense-developer/August2021/Subsystems/NetSDKAPIref/Content/Qlik.Engine.I...

So instead of doing:

 

var app = location.App(appId);

 

You do:

 

var app = location.App(appId, SessionToken.Custom("mytoken"));

 

Or possibly this to get a guaranteed unique session:

 

var app = location.App(appId, SessionToken.Unique());

 

View solution in original post

2 Replies
Øystein_Kolsrud
Employee
Employee

An API key is strictly tied to a specific user, so if you authenticate using such a key, then you will end up as accessing the system as that user only. But you can still make multiple connections to Qlik SaaS that have independent sessions (or selection states if you like). You achieve this by specifying a session token in the second argument to  method IQcsLocation.App:

https://help.qlik.com/en-US/sense-developer/August2021/Subsystems/NetSDKAPIref/Content/Qlik.Engine.I...

So instead of doing:

 

var app = location.App(appId);

 

You do:

 

var app = location.App(appId, SessionToken.Custom("mytoken"));

 

Or possibly this to get a guaranteed unique session:

 

var app = location.App(appId, SessionToken.Unique());

 

Josh_Rmg
Contributor II
Contributor II
Author

Perfect thanks @Øystein_Kolsrud