I’m looking for a way to log out all the inactive users even if they have closed the app/browser.
I already record the “last activity” date for each and I can log them out client side, but I also want to log them out if they have quit the app, or closed the browser.
It’s not a client-side solution. It’s server-side.
It’s a superadmin resetting the user password and using it to invoke an Auth API workflow, with the user email and the newly reset password, to receive a user token and invoke another API workflow that uses the Log the user out action.
The only downside is that the user’s password is reset and if he comes back he would need to reset the password to be able to log in. Not very user-friendly.
Since this is the final goal, there are indeed other ways to achieve it, not involving an automated bulk logout process.
Instead of logging them out, why not set an inactive boolean on the user and log them out on their next visit?
I don’t see the need to do anything else, other than spending more time solving a problem that isn’t really a problem. I could be wrong, and you might have a different argument.
For backend workflows, set a condition only if the user is active and cancel otherwise.
If a user schedules an API workflow and the workflow has the “Log user out” action it will server-side log them out
So you can setup some perpetual thing where on page load (only when user’s API ID is empty) schedules API workflow 24 hours later (store the resulting API ID on the user) → log out user only when their “last activity” date is less than current date/time. Otherwise schedule the workflow again 24 hours later.