<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Impersonate on Qlik Cloud using jwt on .Net SDK in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Impersonate-on-Qlik-Cloud-using-jwt-on-Net-SDK/m-p/2098992#M18924</link>
    <description>&lt;P&gt;If you're doing both REST access and WebSocket access in the same project, then it's worth noting that you can't use the same JWT for authentication twice. You either have to use a new one for each, or connect using existing session for the second one. As example (if you use the package &lt;A href="https://www.nuget.org/packages/QlikSenseRestClient/" target="_blank"&gt;https://www.nuget.org/packages/QlikSenseRestClient/&lt;/A&gt; for REST access), then this won't work because the JWT has already been "expended" when the connection to the app is attempted:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var restClient = new RestClient(url);
restClient.AsJsonWebTokenViaQcs(jwt);
Console.WriteLine(restClient.Get&amp;lt;JToken&amp;gt;("/api/v1/users/me"));

var location = QcsLocation.FromUri(url);
location.AsJwt(jwt);
using (var app = location.App(appId))
{
    Console.WriteLine(app.GetAppProperties().Title);
}&lt;/LI-CODE&gt;
&lt;P&gt;But this will as it reuses the session from the rest access:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var restClient = new RestClient(url);
restClient.AsJsonWebTokenViaQcs(jwt);
Console.WriteLine(restClient.Get&amp;lt;JToken&amp;gt;("/api/v1/users/me"));
            
var info = restClient.QcsSessionInfo;
            
var location = QcsLocation.FromUri(url);
location.AsExistingSession(info.EasSid,info.EasSidSig, info.SessionToken);
using (var app = location.App(appId))
{
    Console.WriteLine(app.GetAppProperties().Title);
}&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 01 Aug 2023 09:17:22 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2023-08-01T09:17:22Z</dc:date>
    <item>
      <title>Impersonate on Qlik Cloud using jwt on .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Impersonate-on-Qlik-Cloud-using-jwt-on-Net-SDK/m-p/2098180#M18912</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using Qlik Cloud and Iam trying to impersonate with a different user than the current user using jwt session, I got it to work perfectly with the Rest Apis. however, I still need to do the same using the .Net SDK.&lt;/P&gt;
&lt;P&gt;here is how I tried to impersonate using the jwt token that I used with rest api&lt;BR /&gt;&lt;BR /&gt;qcsLocation = QcsLocation.FromUri(mQSenseURL);&lt;BR /&gt;qcsLocation.AsJwt(JwtToken);&lt;/P&gt;
&lt;P&gt;And I tried also with:&lt;/P&gt;
&lt;P&gt;mNETlocation = Location.FromUri(mQSenseURL);&lt;BR /&gt;mNETlocation.VirtualProxyPath = "jwt-session";&lt;BR /&gt;mNETlocation.AsJwtViaProxy(JwtToken);&lt;/P&gt;
&lt;P&gt;Not sure what I am missing, can you help me to get it work?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 07:02:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Impersonate-on-Qlik-Cloud-using-jwt-on-Net-SDK/m-p/2098180#M18912</guid>
      <dc:creator>Jmikhail</dc:creator>
      <dc:date>2023-08-01T07:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Impersonate on Qlik Cloud using jwt on .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Impersonate-on-Qlik-Cloud-using-jwt-on-Net-SDK/m-p/2098992#M18924</link>
      <description>&lt;P&gt;If you're doing both REST access and WebSocket access in the same project, then it's worth noting that you can't use the same JWT for authentication twice. You either have to use a new one for each, or connect using existing session for the second one. As example (if you use the package &lt;A href="https://www.nuget.org/packages/QlikSenseRestClient/" target="_blank"&gt;https://www.nuget.org/packages/QlikSenseRestClient/&lt;/A&gt; for REST access), then this won't work because the JWT has already been "expended" when the connection to the app is attempted:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var restClient = new RestClient(url);
restClient.AsJsonWebTokenViaQcs(jwt);
Console.WriteLine(restClient.Get&amp;lt;JToken&amp;gt;("/api/v1/users/me"));

var location = QcsLocation.FromUri(url);
location.AsJwt(jwt);
using (var app = location.App(appId))
{
    Console.WriteLine(app.GetAppProperties().Title);
}&lt;/LI-CODE&gt;
&lt;P&gt;But this will as it reuses the session from the rest access:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var restClient = new RestClient(url);
restClient.AsJsonWebTokenViaQcs(jwt);
Console.WriteLine(restClient.Get&amp;lt;JToken&amp;gt;("/api/v1/users/me"));
            
var info = restClient.QcsSessionInfo;
            
var location = QcsLocation.FromUri(url);
location.AsExistingSession(info.EasSid,info.EasSidSig, info.SessionToken);
using (var app = location.App(appId))
{
    Console.WriteLine(app.GetAppProperties().Title);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Aug 2023 09:17:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Impersonate-on-Qlik-Cloud-using-jwt-on-Net-SDK/m-p/2098992#M18924</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2023-08-01T09:17:22Z</dc:date>
    </item>
  </channel>
</rss>

