Log out from all devices

Hello guys,


I am making an application for web and mobile. The overview of problem is i can log in from web and mobile at the same time, so if i hit log out from all devices from web or mobile so the particular user should be logged out from every where automatically. Small help will be appreciated.



Thank you

Best regards 

Vaibhav 

Solution

Hi Vaibhav Mathur,

In order to accomplish your requirement, as per my understanding you will have to follow the below steps:

  • Create a Device Entity with relevant attributes i.e Id, Device Info (GUID for web, UUID for mobile), UserId, IsActive [GUID - GenerateGuid]
  • In every User Login, create a record in Device table with the IsActive flag attribute value to True against the GUID or UUID (Store the GUID value in one of the session variable (web app) or Client variables (mobile app) during the login phase and flush the client variable value during the Logout action)
  • Whenever the end-user uses the 'Log out from all devices' functionality from either Web application or Mobile application - Update IsActive attribute value to False for all the record in the Device entity based on the UserId value.
  • In addition to that, in every activity trigger within the web application or Mobile application, call a common action to check the latest value of IsActive attribute for the respective DeviceId, if the IsActive attribute value is False, explicitly Logout the user from the application using the Logout system action and delete the respective record and flush the client variable value.


Hope this helps you!


Regards,

Benjith Sam

Solution

Hi Benjith Sam,



So i have to call or hit the logic in every screen for checking the value of IsActive? 


Regard,

Vaibhav







A bit extra information, see this post.

Cheers

Vaibhav Mathur wrote:

Hi Benjith Sam,

So i have to call or hit the logic in every screen for checking the value of IsActive? 


Regard,

Vaibhav

Hi Vaibhav, 

Sorry for the late reply. Yes, we have to check the flag attribute value in every web request as mentioned in the post shared by Miguel Verdasca, we can use OnBeginWebRequest for that purpose.

Note: There might be multiple solution for this requirement, but this is what it came to my mind :)


Hope this helps you!


Regards,

Benjith Sam