Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Mar 26, 2020 10:41:18 PM
Mar 26, 2020 10:41:18 PM
Dear all,
Below is a release note from Feb 2020 SR1 version of NPrinting
Chrome SameSite cookie
Jira issue ID: OP-9144
Starting from February 2020, Google Chrome 80 manages the
SameSite cookie differently. Qlik NPrinting supports this new
configuration on both HTTP and HTTPS connections. On-Demand for
Qlik Sense and QlikView will continue to work.
The above change has an impact on all users using API calls running from Qlik Sense or QlikView load scripts as the script to return variable with cookie string will be empty.
You need to adjust your script for it to continue to work:
Old version:
//Extracts session cookie from the API response
let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);
New Version (note that you need to change the way variable vCookie is created!
//Extracts session cookie from the API response
Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items');
Let vCookie = TextBetween('$(vCookieRaw)','SameSite=None,','Path=/',2);
thats it.
thanks
Lech
Hi Lech,
looks like with Feb 2021 this has changed again. any idea how to extract the session cookie now?
Thanks
Didier
Hi @didierodayo
i suggest you first check how your raw cookie looks like... then it is just adjusting formula to extract correct bit from it. It may differ between NPrinitng versions, rest connector versions etc...
in my environment at the moment I am using:
Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items');
Let vCookie = TextBetween('$(vCookieRaw)','SameSite=None,','Path=/',3);
and this is in regards my subroutines which you can preview on https://nprintingadventures.com/:
SUB NP_Authenticate
// Connect to NPrinting using the GET REST Connection
LIB CONNECT TO '$(vConnection_GET)';
// Perform a GET call to NPrinting NTLM login API
RestConnectorMasterTable:
SQL SELECT
"Set-Cookie",
"__KEY__response_header"
FROM
JSON "_response_header" PK "__KEY__response_header"
;
cookie_items:
LOAD
[Set-Cookie] AS [Set-Cookie]
RESIDENT
RestConnectorMasterTable
WHERE
NOT IsNull([__KEY__response_header])
;
// Extracts session cookie from the API response
Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items');
// Cookie version
If $(vNPVersion) < 20200201 Then
Trace Loading cookie based on NPrinting version prior Feb 2020 SR1 release;
Let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);
ElseIf $(vNPVersion) < 20200401 Then
Trace Loading cookie based on NPrinting version equal or post Feb 2020 SR1 release;
Let vCookie = TextBetween('$(vCookieRaw)','SameSite=None,','Path=/',2);
Else
Trace Loading cookie based on NPrinting version equal or post Seb 2020 Initial release;
Let vCookie = TextBetween('$(vCookieRaw)','SameSite=None,','Path=/',3);
EndIf
;
DROP TABLE RestConnectorMasterTable;
// Trace
Trace ---;
Trace Raw Session Cookie: "$(vCookieRaw)";
Trace Truncated Session Cookie: "$(vCookie)";
ENDSUB
Thanks Lech,
this worked
Let vCookie = TextBetween(vCookieRaw,'SameSite=None,','Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);