Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
TomaszP
Contributor II
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!

1 Solution

Accepted Solutions
Aiham_Azmeh
Employee
Employee

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.

View solution in original post

7 Replies
Aiham_Azmeh
Employee
Employee

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
Contributor II
Contributor II
Author

Hi @Aiham_Azmeh,

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.

Aiham_Azmeh
Employee
Employee

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
Contributor II
Contributor II
Author

I'm using Qlik Sense November 2018 Patch 1

Aiham_Azmeh
Employee
Employee

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
Contributor II
Contributor II
Author

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

TomaszP
Contributor II
Contributor II
Author

Thank you. After installing Patch 2 everything is working.