Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hi All,
I'm investigating.
Best Regards,
Ruggero
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
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
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:
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?
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
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
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
yep - lets see what @juraj_misina comes back with. If he could get it working - so should we!! ...I hope ... 🙂
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