Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dova
Contributor
Contributor

CSP connection redirect with Qlik sense cloud Iframes

Hi, 

I tried yesterday to load iframes on my own server webpages.

I could render the iframes as i wanted with the cuts i wanted, but i had an issue with the login of Qlik Sense.

If the user wants to see the dashboards and load the iframes, he needs to be connected to Qlik by the portal,

and if not logged, an access security error pops instead of the wanted iframe. What i want to do is, if the user not logged, i want to iframe the QlikSense Cloud login webpage instead of the dashboard to obligate him to log in.

Maybe, should i log him myself with asking his ids and in back-end create a "hidden" browser to log him with puppeteer ?

Do someone knows how to do it ? 

Thanks for the help 🙂

 

 <script type="text/javascript">
    const webIntegrationId = "Nope";
    function login() {
      function isLoggedIn() {
        return fetch("https://logimust.eu.qlikcloud.com/api/v1/users/me", {
          method: 'GET',
          mode: 'cors',
          credentials: 'include',
          headers: {
            'Content-Type': 'application/json',
            'qlik-web-integration-id': webIntegrationId,
          },
        }).then(response => {
          return response.status === 200;
        });
      }
      return isLoggedIn().then(loggedIn => {
        if (!loggedIn) {
          // check login
            window.location.href = "https://logimust.eu.qlikcloud.com/login?qlik-web-integration-id=" + webIntegrationId + "&returnto=" + location.href;          
        }
      });
    }
    login()
  </script>

 

The Puppetteer idea :

 

 async() =>{
                        let browser = await puppeteer.launch({ headless:false});
                        let page = await browser.newPage();
                        if(Object.keys(cookies).length){
                          await page.setCookie(...cookies);
                          
                          await page.goto('https://login.qlik.com/', {waitUntil:'networkidle2'});
                          await page.type('#email', config.username, {delay:30});
                          await page.type('#pass', config.password, {delay:30});
                          await page.click('#auth0-label-submit');              
                     
                          await page.waitForNavigation({ waitUntil: 'networkidle0'});
                          await page.waitFor(2500);
                          try{
                            await page.click('#item-open-button-5e45453be9e9390001bf17c6');
                          }catch(error){
                            console.log(error);
                            process.exit(0);
                          }
                          let currentCookies = await page.cookies();
                          fs.writeFileSync('../../api/config/cookies.json',JSON.stringify(currentCookies));
                        }else{
                          res.send('Connected');                        
                      }

 

 

Labels (2)
1 Solution

Accepted Solutions
Damien_V
Support
Support

Hello,

As the error message says, you should just need to add the parent website URL (where the iFrame is hosted) in the web integration whitelist in the Qlik Console.

If the issue is solved please mark the answer with Accept as Solution.

View solution in original post

6 Replies
Dova
Contributor
Contributor
Author

@Damien_V  Maybe do you knows how to proceed ? I tried to mail you yesterday but i hasn't your email.

Damien_V
Support
Support

Hello @Dova 

It's not allowed to iFrame the Qlik ID page, and most other IdP also do not allow to iFrame their login page.

You would need to have the login page loads outside the iFrame and redirect back to your website when authentication is completed.

If the issue is solved please mark the answer with Accept as Solution.
Dova
Contributor
Contributor
Author

Yeah i understand but the code you posted for the CSP is supposed to redirect to the QlikSense Cloud Login page no? Because it supposed to redirect to the qlik login page with the href but it not works, i forgot something or i don't understand the operation ?

window.location.href = "https://logimust.eu.qlikcloud.com/login?qlik-web-integration-id=" + webIntegrationId + "&returnto=" + location.href;
Damien_V
Support
Support

Yes, that code must run outside the iFrame on your website and it will redirect the whole page to the Qlik login page, then redirect back to your website when authentication is completed.

If the issue is solved please mark the answer with Accept as Solution.
Dova
Contributor
Contributor
Author

Thanks, i inserted in my webpage a link to the login page if  user is not connected but i need to allow an option in the hub maybe ?

  "errors": [
    {
      "title": "returnto not included in web integration whitelist",
      "code": "LOGIN-10",
      "status": "401"
    }
  ],
Damien_V
Support
Support

Hello,

As the error message says, you should just need to add the parent website URL (where the iFrame is hosted) in the web integration whitelist in the Qlik Console.

If the issue is solved please mark the answer with Accept as Solution.