Skip to main content
13-Aquamarine
Jun 28, 2023 1:41 AM UTC
Solved

How can I obtain the session information of a logged-in user?

I need to capture the user's information, such as the client IP and TWX Organization, by intercepting the Login event.

 

Unfortunately, the LoginSucceeded event of the SecurityMonitor Thing does not provide the session information of the logged-in user, and the CurrentSessionInfo Snippets are also unable to access the user's session information as they are not executed by the logged-in user.

 

Is there a solution available? Or should I customize the Authenticator?

 

 

 

12-Amethyst
Jun 30, 2023 2:52 PM UTC

You could add a session variable or a hidden counter on the landing page.  If this value is 0 log the information, if greater than 0 don't log.  You would have to test how session timeout is handled and tweak as necessary.

6 replies

22-Sapphire I
Jun 28, 2023 1:13 PM UTC

What is the actual use case for this need?

Translate
hno13-AquamarineAuthor
13-Aquamarine
Jun 29, 2023 12:00 AM UTC

i need to store and manage user login records in database, and the built-in login history provided by Thingworx lacks sufficient user information.

Translate
22-Sapphire I
Jun 29, 2023 4:52 PM UTC

If you have a 'landing page' set, you can just run a service onload for this and add all necessary information since you'll have appropriate currentuser context.

Translate