Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Highlighted
TomaszP
New Contributor II

Getting 403 when using exportPdf method

Hello Everyone,

I'm integrating  Qlik Sense with our custom app. One of the requirements is to have export as pdf functionality. I use exportPdf method (https://help.qlik.com/en-US/sense-developer/November2018/Subsystems/APIs/Content/Sense_ClientAPIs/Ca...). I have Qlik Sense November 2018 Patch 1 version installed on the server.

I used this method in mashup editor and it works well. When I moved the code to our app I'm getting 403 error: "The initial authentication request must be a "GET" request in order to be redirected to the authentication module". 

app.visualization.get(objId).then(function (model) {                                        
    var settings = {
       documentSize: { width: 297, height: 210 },
       aspectRatio: 0,
       objectSize: { width: 400, height: 300 }
    };

    $(".exporttopdf").click(function (e) {                                            
         model.exportPdf(settings).then(function (result) {
             window.open(result, "_blank");
         });
     });
});

Any ideas how to make this work?

Thanks!

6 Replies
Employee
Employee

Re: Getting 403 when using exportPdf method

Hi @TomaszP,

When you are in dev-hub, you are already authenticated against your Qlik Sense Server instance, once you move the code outside you need to authenticate. You can search the community for good example (ex. https://community.qlik.com/t5/Qlik-Sense-Integration/Mashup-Capability-API-without-a-redirect-for-au...)

Note that if your users are logged in as Anonymous, this is a documented limitation in the release note:

Export as Anonymous does not work for mashups deployed in a domain that is different from the domain in which Qlik Sense is installed. Export only works for Anonymous if the mashup is deployed in the same domain as Qlik Sense.

see -> https://da3hntz84uekx.cloudfront.net/QlikSense/12.44/0/QlikSense_November_2018_ReleaseNotes.pdf

 

I hope this helps

TomaszP
New Contributor II

Re: Getting 403 when using exportPdf method

Hi @aaz,

Thanks for reply.

I checked this, I have the session cookie (X-Qlik-Session) on place. When I ask for require.js file from qlik server I geting redirected to internal windows authentication, I get the qlikTicket and then cookie is set (I can see Set-Cookie in response header). 

When request for pdf is sent ("<server>/printing/export/object/pdf") this cookie is not attached to request.

Employee
Employee

Re: Getting 403 when using exportPdf method

I can't reproduce the issue - can you tell us what Qlik Sense version you are using?

I just found a similar issue in our bug reporting system and it seems to have been fixed in the Nov patch 2 release

TomaszP
New Contributor II

Re: Getting 403 when using exportPdf method

I'm using Qlik Sense November 2018 Patch 1

Employee
Employee

Re: Getting 403 when using exportPdf method

Allright, as mentioned before - I just found a similar issue in our bug reporting system and it seems to have been fixed in the Nov patch 2 . Try to upgrade.
TomaszP
New Contributor II

Re: Getting 403 when using exportPdf method

Thank you. I will upgrade to Patch 2 and I will let you know if that helped.

Community Browser