<?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 JWT authentication in mashup in Data Movement &amp; Streaming</title>
    <link>https://community.qlik.com/t5/Data-Movement-Streaming/JWT-authentication-in-mashup/m-p/2500262#M2984</link>
    <description>&lt;P&gt;I am trying to login a html mashup to Qlik Cloud using JWT auth. &lt;BR /&gt;The JWT was authenticated and the login was successful. But i am not able &lt;BR /&gt;to get the visualization of an object. I am getting the following error.&lt;BR /&gt;How to proceed after this? Any insight on this might be helpful.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="invalid vizz.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176238i50AA4333033356C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="invalid vizz.png" alt="invalid vizz.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;var config = {
    host: 'yourtenant.eu.qlikcloud.com',
    prefix: '/',
    port: 443,
    isSecure: true,
    webIntegrationId: 'F2czdB5yjECRAGLuIi4hiiTEgNjPpW2R',
	jwt: 'eyJhbGciOi...VviRm5uOm_0P85_REW_8vgW9O6ueRDg-ErDNNspY7bPZsx2jKgJKyxWgp1dLyq5Hh_HcD7SBh5xbqD8vjkhrhPMAJ-jU98SHcvi33YqCbd8gdHTiDXP3YUuV5ptMKo5ATmcMUb2JhPQMviGLJfCWkJoUhffGOktKSZ36HIiTTfg'
};

//Redirect to login if user is not logged in
async function login() {
    function isLoggedIn() {
        return fetch("https://"+config.host+"/api/v1/users/me", {
            method: 'GET',
            mode: 'cors',
            credentials: 'include',
            headers: {
            'Content-Type': 'application/json',
            'qlik-web-integration-id': config.webIntegrationId
            },
        }).then(response =&amp;gt; response.status === 200);
    }

    return isLoggedIn().then((loggedIn) =&amp;gt; {
        if (!loggedIn) {
            return fetch("https://"+config.host+"/login/jwt-session", {
                method: 'POST',
                mode: 'cors',
                credentials: 'include',
                headers: {
                    'Content-Type': 'application/json',
                    'qlik-web-integration-id': config.webIntegrationId,
                    'Authorization':'Bearer '+config.jwt
                },
            }).then((response) =&amp;gt; {
                if (response.status !== 200) {
                    throw new Error('failed to login via jwt');
                }
            });
        }
    });
}

login().then(() =&amp;gt; {
    require.config({
        baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources",
        webIntegrationId: config.webIntegrationId
    });

    require( ["js/qlik"], function ( qlik ) {
        qlik.on( "error", function ( error ) {
            $( '#popupText' ).append( error.message + "&amp;lt;br&amp;gt;" );
            $( '#popup' ).fadeIn( 1000 );
        } );
        $( "#closePopup" ).click( function () {
            $( '#popup' ).hide();
        } );
        //open apps -- inserted here --
        var app = qlik.openApp( 'fd91cc5b-b59b-4a5f-bfb8-3de888b3882c', config );
        
        //get objects -- inserted here --
        app.visualization.get('jCFJJ').then(function(vis){
        vis.show("QV01");	
        });
    });
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2025 21:46:28 GMT</pubDate>
    <dc:creator>muthunandhi27</dc:creator>
    <dc:date>2025-03-19T21:46:28Z</dc:date>
    <item>
      <title>JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Data-Movement-Streaming/JWT-authentication-in-mashup/m-p/2500262#M2984</link>
      <description>&lt;P&gt;I am trying to login a html mashup to Qlik Cloud using JWT auth. &lt;BR /&gt;The JWT was authenticated and the login was successful. But i am not able &lt;BR /&gt;to get the visualization of an object. I am getting the following error.&lt;BR /&gt;How to proceed after this? Any insight on this might be helpful.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="invalid vizz.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176238i50AA4333033356C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="invalid vizz.png" alt="invalid vizz.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;var config = {
    host: 'yourtenant.eu.qlikcloud.com',
    prefix: '/',
    port: 443,
    isSecure: true,
    webIntegrationId: 'F2czdB5yjECRAGLuIi4hiiTEgNjPpW2R',
	jwt: 'eyJhbGciOi...VviRm5uOm_0P85_REW_8vgW9O6ueRDg-ErDNNspY7bPZsx2jKgJKyxWgp1dLyq5Hh_HcD7SBh5xbqD8vjkhrhPMAJ-jU98SHcvi33YqCbd8gdHTiDXP3YUuV5ptMKo5ATmcMUb2JhPQMviGLJfCWkJoUhffGOktKSZ36HIiTTfg'
};

//Redirect to login if user is not logged in
async function login() {
    function isLoggedIn() {
        return fetch("https://"+config.host+"/api/v1/users/me", {
            method: 'GET',
            mode: 'cors',
            credentials: 'include',
            headers: {
            'Content-Type': 'application/json',
            'qlik-web-integration-id': config.webIntegrationId
            },
        }).then(response =&amp;gt; response.status === 200);
    }

    return isLoggedIn().then((loggedIn) =&amp;gt; {
        if (!loggedIn) {
            return fetch("https://"+config.host+"/login/jwt-session", {
                method: 'POST',
                mode: 'cors',
                credentials: 'include',
                headers: {
                    'Content-Type': 'application/json',
                    'qlik-web-integration-id': config.webIntegrationId,
                    'Authorization':'Bearer '+config.jwt
                },
            }).then((response) =&amp;gt; {
                if (response.status !== 200) {
                    throw new Error('failed to login via jwt');
                }
            });
        }
    });
}

login().then(() =&amp;gt; {
    require.config({
        baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources",
        webIntegrationId: config.webIntegrationId
    });

    require( ["js/qlik"], function ( qlik ) {
        qlik.on( "error", function ( error ) {
            $( '#popupText' ).append( error.message + "&amp;lt;br&amp;gt;" );
            $( '#popup' ).fadeIn( 1000 );
        } );
        $( "#closePopup" ).click( function () {
            $( '#popup' ).hide();
        } );
        //open apps -- inserted here --
        var app = qlik.openApp( 'fd91cc5b-b59b-4a5f-bfb8-3de888b3882c', config );
        
        //get objects -- inserted here --
        app.visualization.get('jCFJJ').then(function(vis){
        vis.show("QV01");	
        });
    });
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 21:46:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Movement-Streaming/JWT-authentication-in-mashup/m-p/2500262#M2984</guid>
      <dc:creator>muthunandhi27</dc:creator>
      <dc:date>2025-03-19T21:46:28Z</dc:date>
    </item>
  </channel>
</rss>

