<?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 Windows authentication and QRS API : works only using default credentials in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1539078#M9952</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to automate application deployment using the QRS Api. Therefore i want to connect to the QRS API with a deployment user&amp;nbsp; (existing user in the domain and in Qlik)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the following example :&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense-developer/November2018/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Windows.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/November2018/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Windows.htm&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;//Create the HTTP Request and add required headers and content in xrfkey
string xrfkey = "0123456789abcdef";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://servername.com/QRS/app?xrfkey=" + xrfkey);
request.Method = "GET";
request.UserAgent = "Windows";
request.Accept = "application/json";
request.Headers.Add("X-Qlik-xrfkey", xrfkey);
// specify to run as the current Microsoft Windows user
request.UseDefaultCredentials = true;
// make the web request and return the content
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
Console.WriteLine(new StreamReader(stream).ReadToEnd());&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I worked well. But when i'm trying to change the user by switching line&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;request.UseDefaultCredentials = true;&lt;/PRE&gt;&lt;P&gt;to something like&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;request.Credentials = new System.Net.NetworkCredential(userInfo.Login, userInfo.Password, userInfo.Domain);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;i'm always getting an http 401 response, even when using the exact same login/pass/domain i used to log into the server (should be the same as default credential).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strangely, when trying to access to the QPS API with the same credentials, il works well ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas/advice how to fix this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 21:28:28 GMT</pubDate>
    <dc:creator>PierreSeiitra</dc:creator>
    <dc:date>2024-11-16T21:28:28Z</dc:date>
    <item>
      <title>Windows authentication and QRS API : works only using default credentials</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1539078#M9952</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to automate application deployment using the QRS Api. Therefore i want to connect to the QRS API with a deployment user&amp;nbsp; (existing user in the domain and in Qlik)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the following example :&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense-developer/November2018/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Windows.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/November2018/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Windows.htm&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;//Create the HTTP Request and add required headers and content in xrfkey
string xrfkey = "0123456789abcdef";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://servername.com/QRS/app?xrfkey=" + xrfkey);
request.Method = "GET";
request.UserAgent = "Windows";
request.Accept = "application/json";
request.Headers.Add("X-Qlik-xrfkey", xrfkey);
// specify to run as the current Microsoft Windows user
request.UseDefaultCredentials = true;
// make the web request and return the content
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
Console.WriteLine(new StreamReader(stream).ReadToEnd());&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I worked well. But when i'm trying to change the user by switching line&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;request.UseDefaultCredentials = true;&lt;/PRE&gt;&lt;P&gt;to something like&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;request.Credentials = new System.Net.NetworkCredential(userInfo.Login, userInfo.Password, userInfo.Domain);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;i'm always getting an http 401 response, even when using the exact same login/pass/domain i used to log into the server (should be the same as default credential).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strangely, when trying to access to the QPS API with the same credentials, il works well ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas/advice how to fix this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 21:28:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1539078#M9952</guid>
      <dc:creator>PierreSeiitra</dc:creator>
      <dc:date>2024-11-16T21:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Windows authentication and QRS API : works only using default credentials</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1545929#M10029</link>
      <description>&lt;P&gt;I was finally able to figure this one out. I've also been wondering about this for quite some time. The trick was to add the credential to a credential cache, then pass along the right header in the request. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var credentialCache = new CredentialCache();
credentialCache.Add(&amp;lt;url&amp;gt;, "ntlm", credential);
request.UseDefaultCredentials = false;
request.Headers[HttpRequestHeader.Authorization] = "ntlm";
request.Credentials = credentialCache;&lt;/PRE&gt;
&lt;P&gt;I really can't give a good explanation for where that "ntlm" constant comes from though, but it seems like it's necessary. If anyone can point to a good site documenting that HTML authentication flow, then I would be happy to read it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Anyway, I've updated this project so that it now supports this type of authentication as well:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/kolsrud/qlik_rest_sdk" target="_blank"&gt;https://github.com/kolsrud/qlik_rest_sdk&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Nuget package available here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nuget.org/packages/QlikSenseRestClient" target="_blank"&gt;https://www.nuget.org/packages/QlikSenseRestClient&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 14:12:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1545929#M10029</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-02-18T14:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Windows authentication and QRS API : works only using default credentials</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1548556#M10057</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/60147"&gt;@PierreSeiitra&lt;/a&gt;: Were you able to try this out? I'm curious to learn if it works in other environments than simply on my machine.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 08:28:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1548556#M10057</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-02-25T08:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Windows authentication and QRS API : works only using default credentials</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1623639#M11296</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/41242"&gt;@Øystein_Kolsrud&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't tried your suggestion yet. I ended up using powershell to remotly execute my deployment tool with the right user.&lt;/P&gt;&lt;P&gt;I'll give a try next time i'll work on this tool.&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 09:50:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1623639#M11296</guid>
      <dc:creator>PierreSeiitra</dc:creator>
      <dc:date>2019-09-13T09:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Windows authentication and QRS API : works only using default credentials</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1624028#M11309</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Good news, your fix works fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 07:28:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Windows-authentication-and-QRS-API-works-only-using-default/m-p/1624028#M11309</guid>
      <dc:creator>PierreSeiitra</dc:creator>
      <dc:date>2019-09-16T07:28:25Z</dc:date>
    </item>
  </channel>
</rss>

