28
Views
1
Comments
How to track user login/logout in OutSystems and log details
Application Type
Mobile, Reactive

Hi All,

I want to capture when a user logs in and logs out from an OutSystems application, so I can store the details (UserId, timestamp, application name) in a log table.

I’m looking for guidance on:

  • How to detect explicit logout (when the user clicks the logout link).

  • How to handle session timeout as a “logout” event.

  • Best practices to store these details for audit/reporting.

  • While SSO login is enabled, how to capture logins from different applications.

Any suggestions, examples, or best practices would be really helpful.

Thanks,
Harika




2019-11-11 17-10-24
Manish Jawla
 
MVP

Hi @Harika ,

You can follow the below steps:

  • Create a log table (UserId, AppName, LoginAt, LastActiveAt, LogoutAt, LogoutReason, SessionGuid).

  • On login (normal or SSO), insert a row with LoginAt and SessionGuid.

  • On every screen load, update LastActiveAt (via Layout’s OnReady).

  • On logout click, update the row with LogoutAt and reason = “Explicit”, then call Users\Logout.

  • For session timeout, run a Timer to close sessions where LastActiveAt is older than your timeout, mark LogoutAt and reason = “Timeout”.

  • For multiple apps with SSO, log separately in each app with its AppName.

few links for reference:

https://www.outsystems.com/forge/component-overview/10443/single-session-user-login-ideal-session-timeout-o11 

https://www.outsystems.com/forums/discussion/73905/end-user-login-audit/ 

regards,

Manish Jawla


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