159
Views
6
Comments
How to get Outsystem Session ID 
Question

Hi All,

I tried to get Users.sid value after logged on at server action with GetCookie, it returns empty value. Anyone know how to get the value?


2024-07-12 05-57-50
Gourav Shrivastava
Champion

In OutSystems Reactive Web, there isn’t a direct way to retrieve the session ID like in traditional web applications. OutSystems abstracts session handling, so you don’t have direct access to the session ID. However, you can implement alternative ways to manage unique session identifiers if needed. you can use this approach


In Reactive Web apps, you can use client variables (local storage or session storage) or cookies to simulate session tracking.

  1. In JavaScript, generate a unique ID when a user starts a session.
  2. Save this ID in session storage:

    sessionStorage.setItem('SessionID', 'unique-id');

  3. You can access this ID with JavaScript sessionStorage.getItem('SessionID'); 


Thanks 

Regards Gourav Shrivastava

UserImage.jpg
Drexxor

Thank you. This is helpful. Is it possible to set unique id using server action instead of javascript?

2024-07-12 05-57-50
Gourav Shrivastava
Champion

No needed!  Please use JavaScript  for that 

In OutSystems, server actions run on the server side and don't have direct access to client-side session storage (such as sessionStorage in JavaScript) because session storage is client-side and scoped to the browser. 



Thanks 

Regards Gourav Shrivastava

2024-07-12 05-57-50
Gourav Shrivastava
Champion

If you need you can also generate UUID from the server action for security purposes,take the output from this, and set the session in the client action  

Thanks 

Regards Gourav Shrivastava

2020-08-31 05-04-40
Rahul Jain

Hi Drexxor ,

You can try by GetSessionId.


Thanks

--RJ--

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Did you not read the information message in the screenshot you shared?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.