Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

NPrinting APIs No Longer Working After Upgrading to NPrinting Nov 2019

We just upgraded our NPrinting instance to the November 2019 version (SR1).  (Our Qlik version is also Nov 2019 - Patch 6.)  We had been using NPrinting REST connections successfully prior to this upgrade to run NPrinting tasks using Qlik Sense load script.  Now, when we try to test the NPrinting Get and Post API connections, we're getting a 401 error: "HTTP protocol error 401 (Unauthorized): Requested resource requires authentication."

We have verified every aspect of the connection settings: we're using Windows NTLM, using an NPrinting user that was created based on the Qlik service account, etc.  Like I said, all of this was working prior to the upgrade, but now it isn't.

I've tested the URL we're using with a Chrome browser - and the URL is returning information successfully via Chrome.  But not with Qlik.

We're out of ideas - and I'm not finding any posts out there with similar issues.  So any help from the Community would be much appreciated.

Thanks!
Steve

Labels (3)
1 Solution

Accepted Solutions
Highlighted
Contributor III
Contributor III

So I figured this out.  Here's the code you need to use:

let vNPCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vNPCookie = TextBetween('$(vNPCookieRaw)','SameSite=None,','Path=/',2);

View solution in original post

3 Replies
Highlighted
Contributor III
Contributor III

After some research, I'm realizing that the cookie returned from NPrinting has changed in the November 2019 version.  The cookie information returned from NPrinting used to look like this (the red portion is what we parsed out as the final cookie to send back to NPrinting):

NPWEBCONSOLE_XSRF-TOKEN=a3jv9maV/ApzN/59isZXcH2DqMjRHdq+fJKe6Z6s3wE=; Path=/; Secure,NPWEBCONSOLE_SESSION=7f6c7fe9655c77a31b73e7a4be3edac9833ddda6-%00NPWEBCONSOLE_XSRF-TOKEN%3Aa3jv9maV%2FApzN%2F59isZXcH2DqMjRHdq%2BfJKe6Z6s3wE%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure,NPWEBCONSOLE_SESSION=68d3fb19d37412f518f8be7e61f47d8073228448-%00_TS%3Asession%00%00userid%3Af00ec7ac86bf46e481bfa02d809a9977%00%00userlogin%3A2020-03-27T18%3A15%3A02.5981740Z%00%00NPWEBCONSOLE_XSRF-TOKEN%3Aa3jv9maV%2FApzN%2F59isZXcH2DqMjRHdq%2BfJKe6Z6s3wE%3D%00; Path=/; HttpOnly; Secure

However, now the cookie information looks like this:

NPWEBCONSOLE_XSRF-TOKEN=FDJIyaUWDtIQ8Ajiw4/KLwvhXpsE4wf2VhBANs6dwmA=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=13a27f6ece749022906de6dc81fe3303e34be70e-%00NPWEBCONSOLE_XSRF-TOKEN%3AFDJIyaUWDtIQ8Ajiw4%2FKLwvhXpsE4wf2VhBANs6dwmA%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure; SameSite=None,NPWEBCONSOLE_SESSION=c51a57ebb6d6430c387b378b68def094e3b1f813-%00_TS%3Asession%00%00userid%3Aad3f1e18086040a39f6b094fde386016%00%00userlogin%3A2020-03-27T18%3A17%3A51.1993157Z%00%00NPWEBCONSOLE_XSRF-TOKEN%3AFDJIyaUWDtIQ8Ajiw4%2FKLwvhXpsE4wf2VhBANs6dwmA%3D%00; Path=/; HttpOnly; Secure; SameSite=None

There's now a semicolon after the word "Secure", and the phrase "SameSite=None".  I'm trying to figure out what text I need to parse out to be able to send back to NPrinting to make an API post call to run a task.   Nothing is working for me so far.

Anyone know how this works now?

Highlighted
Contributor III
Contributor III

I guess bottom line, here's what I need to know.  Prior to our upgrade to Qlik and NPrinting Nov 2019 versions, here's the code we were using to create the cookie to send back to NPrinting:

let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);

That code no longer works.  Does anyone know what the new code is for creating vCookie?

Highlighted
Contributor III
Contributor III

So I figured this out.  Here's the code you need to use:

let vNPCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vNPCookie = TextBetween('$(vNPCookieRaw)','SameSite=None,','Path=/',2);

View solution in original post