Skip to main content
1-Visitor
Nov 29, 2018 3:38 PM UTC
Question

Set session cookie in Thingworx Services

Hi Developers,

 

When i login to the mashup through browser the JSESSIONID is set to all the thingworx services called during that session. Is there a way to add or set another cookie to those services?

 

I have checked the "Content Loader Function" resource and it only has "Get Cookies" service and nothing else for my use case.

 

Regards,

Saran

 

3 replies

22-Sapphire I
Nov 29, 2018 6:52 PM UTC

My guess is you want to set the cookie in the user browser.

However the Thingworx server (and the collection functions) is server side not client side.

So to manipulate the cookie, you might be able to do it with the Expression widget, else some custom widget (basically one that functions like a client side 'extension' to the mashup capabilities)

I don't think the Expression widget supports the 'document' object through.

Translate
1-Visitor
Nov 30, 2018 5:35 AM UTC

Hi @PaiChung,

 

Thanks for your reply.

 

I have used expression widget to manipulate services but not the browser cookies. Could you please elaborate how to use expression widget for our use case?

 

Regards,

Saran

Translate
22-Sapphire I
Nov 30, 2018 6:17 PM UTC

Again I think the Expression widget doesn't allow you to use the 'document' object

But otherwise here is a reference: https://www.w3schools.com/js/js_cookies.asp

 

Translate