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
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