<?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: How to get the credentials of the current authenticated user to call a REST web service on a separate back-end server? in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-get-the-credentials-of-the-current-authenticated-user-to/m-p/1247568#M6703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We don't have any passwords in Qlik, the passwords are stored in your user management system (most commonly Active Directory) and it's the user directory that authenticates the user, not Qlik Sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest solution would be to move your page out from being hosted as an extension and onto a real webserver so you can execute server-side code to authenticate your users both against Qlik Sense but also against any other systems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Dec 2016 19:34:14 GMT</pubDate>
    <dc:creator>Alexander_Thor</dc:creator>
    <dc:date>2016-12-12T19:34:14Z</dc:date>
    <item>
      <title>How to get the credentials of the current authenticated user to call a REST web service on a separate back-end server?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-get-the-credentials-of-the-current-authenticated-user-to/m-p/1247567#M6702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before I ask my question, here's &lt;STRONG&gt;a bit of context and scenario&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;1. My end-users access: &lt;SPAN style="text-decoration: underline;"&gt;&lt;A class="jive-link-external-small" href="https://front-end-qlik-server" rel="nofollow" target="_blank"&gt;https://front-end-qlik-server&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; and are redirected to a login page.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2. They proceed to enter their credentials, submit and are redirected to:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;- &lt;SPAN style="text-decoration: underline;"&gt;&lt;A class="jive-link-external-small" href="https://front-end-" rel="nofollow" target="_blank"&gt;https://front-end-&lt;/A&gt;&lt;SPAN style="font-size: 13.3333px; text-decoration: underline;"&gt;qlik-&lt;/SPAN&gt;server/extensions/ExtensionHome/ExtensionHome.html&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;3. &lt;/SPAN&gt;&lt;STRONG&gt;My site is built on a set of Qlik Sense Extensions&lt;/STRONG&gt; between which the user can navigate:&lt;/P&gt;&lt;P&gt;- &lt;SPAN style="text-decoration: underline;"&gt;&lt;A class="jive-link-external-small" href="https://front-end-" rel="nofollow" target="_blank"&gt;https://front-end-&lt;/A&gt;&lt;SPAN style="font-size: 13.3333px; text-decoration: underline;"&gt;qlik-&lt;/SPAN&gt;server/extensions/Extension1/Extension1.html&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;- &lt;SPAN style="text-decoration: underline;"&gt;&lt;A class="jive-link-external-small" href="https://front-end-" rel="nofollow" target="_blank"&gt;https://front-end-&lt;/A&gt;&lt;SPAN style="font-size: 13.3333px; text-decoration: underline;"&gt;qlik-&lt;/SPAN&gt;server/extensions/Extension2/Extension2.html&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;- and so on...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. These extensions are mashups that embed Qlik objects and other HTML objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. &lt;STRONG&gt;Data is loaded into the page&lt;/STRONG&gt; from Qlik but also &lt;STRONG&gt;from a back-end server&lt;/STRONG&gt; (unrelated to Qlik Sense) that exposes web-services.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data is also posted from the extensions to the web-services&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now, the problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So far I am calling my web services using ajax on the client side, from the JavaScript in my extensions.&lt;/P&gt;&lt;P&gt;These web services need authentication, and right now for development purposes I am using hard coded credentials.&lt;/P&gt;&lt;P&gt;However, I would like to use the Qlik Sense credentials to authenticate the client when calling my web services. (Credentials would be the same for the Qlik Sense server and my back-end server)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Could I get the credentials of the current authenticated user from the JavaScript in my extension?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;My research so far:&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have explored this type of code in my browser js console that gives me the username :&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;var userData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;require( ["js/qlik"], function ( qlik ) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; qlik.getGlobal(config).getAuthenticatedUser(function(reply){&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userData = 'User:'+reply.qReturn;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Of course it would be a major security issue to be able to get the password from the browser on the client side.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;How would experienced Qlik Sense developers deal with this type of situation?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;Perhaps a REST data connector?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;But wouldn't data be static and loaded only once?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;How would I post data to the REST endpoint from the page?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt;"&gt;Could the credentials for the REST connector be set dynamically?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the long description, looking forward to some help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2016 16:28:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-get-the-credentials-of-the-current-authenticated-user-to/m-p/1247567#M6702</guid>
      <dc:creator />
      <dc:date>2016-12-12T16:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the credentials of the current authenticated user to call a REST web service on a separate back-end server?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-get-the-credentials-of-the-current-authenticated-user-to/m-p/1247568#M6703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We don't have any passwords in Qlik, the passwords are stored in your user management system (most commonly Active Directory) and it's the user directory that authenticates the user, not Qlik Sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest solution would be to move your page out from being hosted as an extension and onto a real webserver so you can execute server-side code to authenticate your users both against Qlik Sense but also against any other systems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:34:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-get-the-credentials-of-the-current-authenticated-user-to/m-p/1247568#M6703</guid>
      <dc:creator>Alexander_Thor</dc:creator>
      <dc:date>2016-12-12T19:34:14Z</dc:date>
    </item>
  </channel>
</rss>

