Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Carly_
Contributor III
Contributor III

Nprinting REST API broke after June 2020 update

Goodmorning,

I have a failing script trying to call the Nprinting REST API after updating both Qlik and NPrinting to the June version. I also had this after the February update. The cookie is the problem in both cases. However, then I could easily change it by adjusting the TextBetween formula and now I cannot resolve the issue. Does anybody have an idea on how to change the cookie value so that the connection can be made again? 

I cannot find anything in the release notes this time. 

Labels (2)
39 Replies
Ruggero_Piccoli
Support
Support

Hi All,

I'm investigating. 

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Ruggero_Piccoli
Support
Support

Hi,

Short description:  the issue was introduced with a bugfix few months ago. It looks like the cookie container (that was enabled by default) doesn't work correctly when we send cookie as http header explicitly.

Developers are working to fix the issue.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Patricia_Silva
Specialist II
Specialist II

Hello all,

Thank you for your patience 😊

R&D will release a permanent fix for this issue, but in the meantime you can apply the workaround mentioned on this article:

https://support.qlik.com/articles/000109904

Best Regards,
Patricia

Help users find answers! Don't forget to mark a correct resolution 🙂
micheledenardi
Specialist II
Specialist II

Dear @Patricia_Silva ,

thanks for the update.

I did the replacement of the RestConnectort folder and now i have vCookieRaw that seems complete but there are no traces about "SameSite=None" string inside it:

This is the vCookieRaw i get:

2020-08-24 13_51_02-nPrintingPost - My new sheet _ Sheet - Qlik Sense.png

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
JMohlmann
Contributor
Contributor

It looks like this affects more than just the NPrinting connection.

My rest connector also broke on multiple environments after the update. It used a cookie header to authenticate. (https://community.qlik.com/t5/Qlik-Connectors-Discussions/REST-connector-not-sending-cookie-header/m...)

Is the fix provided in https://support.qlik.com/articles/000109904 also suitable for this or is it only addressing the NPrinting issue?

juraj_misina
Luminary Alumni
Luminary Alumni

Hi @Patricia_Silva. The fix did not work for me, neither did downgrade of REST connector. Do we have any ETA on the permanent fix?

UPDATE: I got it working after inspecting the response from the authentication endpoint more carefully and realizing there are two XSRF Tokens and I need to pick the right one for the authentication cookie.

Thank you

Juraj

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @juraj_misina 

I am in the same boat with you as suggestions from support article did not work (replacing connector and adjusting cookie variable). Can you share more light on to which XSRF Tokens you are picking. Did you mean that you are building your cookie based on one section with token and another with session.  

I am experimenting with this now and I am struggling to get this working

 

Now below is my whole cookie. I am not sure if yours have the same format, but if does would you be able to highlight which parts you are extracting from it? 

"NPWEBCONSOLE_XSRF-TOKEN=F+3fg1AbapPICPGKfva3aCxgTirCJKcHpdEDoPSND24=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=6f6e1ee54cf58c8152229c0101f9adb6ad08126c-%00NPWEBCONSOLE_XSRF-TOKEN%3AF%2B3fg1AbapPICPGKfva3aCxgTirCJKcHpdEDoPSND24%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure; SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=4sh2UJA2jLOD+M4OKljMdRTaK7q7W4DylNSVlYEfgoQ=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=09275514ad755faecdff3cd0b06e455159086052-%00NPWEBCONSOLE_XSRF-TOKEN%3A4sh2UJA2jLOD%2BM4OKljMdRTaK7q7W4DylNSVlYEfgoQ%3D%00%00_TS%3Asession%00%00userid%3A1d547d12aa1443b28024895a9142af93%00%00userlogin%3A2020-09-23T06%3A10%3A24.3171268Z%00; Path=/; HttpOnly; Secure; SameSite=None"

what I am extracting at the moment as a cookie is the part which is in blue... I also tried other parts but with no luck.

@Ruggero_Piccoli - Ruggero I am tagging you here as I am testing this on different versions. Ideally I would like to get this working back again on September 2020.

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
blaise
Partner - Specialist
Partner - Specialist

Please update us on the progress @Lech_Miszkiewicz , I never myself took the time to actually investigate the cookie returned by NP. It would have been good to find a way to extract the relevant part that works for all NP versions

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

yep - lets see what @juraj_misina comes back with. If he could get it working - so should we!!   ...I hope ... 🙂

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
juraj_misina
Luminary Alumni
Luminary Alumni

Hey. Here's what worked for me:

 

LIB CONNECT TO 'NPrinting API connection';

_response_header:
SQL SELECT 
	"Set-Cookie",
	"__KEY__response_header"
FROM JSON "_response_header" PK "__KEY__response_header";

Let vCookieRaw  = Peek('Set-Cookie',0,'cookie_items');
Let vCookie = TextBetween(vCookieRaw,'SameSite=None,','Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);
LET vXSToken = TextBetween(vCookieRaw, 'NPWEBCONSOLE_XSRF-TOKEN=', '; Path', SubStringCount(vCookieRaw,'NPWEBCONSOLE_XSRF-TOKEN='));

LIB CONNECT TO 'NPrinting API RunTask';

_startTask:
SQL SELECT 
	"id",
	"status"
FROM JSON (wrap off) "data"
WITH CONNECTION (
	URL "$(vTaskUrl)",
	HTTPHEADER "cookie" "$(vCookie)",
	HTTPHEADER "X-XSRF-TOKEN" "$(vXSToken)"
);

 

And this is the raw cookie (bold=cookie, red=xsrf token) :

NPWEBCONSOLE_XSRF-TOKEN=sBZ6WvKIAxBQfcSNtK8JNNhm2CcsziAxCEBmMj/hyjQ=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=9f01a5bf47e113dc3ed7beabba649033eefe9b58-%00NPWEBCONSOLE_XSRF-TOKEN%3AsBZ6WvKIAxBQfcSNtK8JNNhm2CcsziAxCEBmMj%2FhyjQ%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure; SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=fG4lsojEMqKBf2/W7pg26t54i7qQZsO1PZkAGdv4yiw=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=7be7ea6ea69acbe4d21ed106ff8039b8dbd857fc-%00NPWEBCONSOLE_XSRF-TOKEN%3AfG4lsojEMqKBf2%2FW7pg26t54i7qQZsO1PZkAGdv4yiw%3D%00%00_TS%3Asession%00%00userid%3A8c11cb83feb846a7a62e7cdd1f84ca76%00%00userlogin%3A2020-09-23T05%3A56%3A45.6631357Z%00; Path=/; HttpOnly; Secure; SameSite=None

 

Hope this helps,

Juraj