UX Design around Log user out

What’s the UX around logging a user out when:

  1. They close the browser tab
  2. They navigate to a different website from your app
    or
  3. If you just want them to reauthenticate themselves after lets say a week of online time?

What?

Workflow: log user out.

Not sure what else you mean?

Are you asking for the workflows needed to do such actions?

You can create you own sessions and log the user out if they close the app (setup a scheduled workflow to log them out st a specified time). Youll need to put a boolean on the user with something like “session_on (true/false)” and turn that to off when they close the page, then schedule the workflow to log the user out if that session value is (no). On page load, turn session on and it wont log them out.

Thats just a simple way i thought of on top of my head.

Sure there are other ways, but you should be able to build from this idea.

Note: youll need to incorporate some way to make sure if they have more than one instance of your app up. You can get a window ID or create a session ID that binds only to a specific window.

@GH5T Do you know of a way to detect when a browser is closed?

I need to log out the user (or mark the user as having closed the browser) as soon as they close their browser. I’ve been trying to find a solution for this and haven’t been able to. I tried custom js to detect pageunload, however that triggers with every page navigation as well and is inconsistent over all browsers.

I thought about custom session cookies as well, however as soon as the browser is closed no client side workflows can run and you can’t seem to use the backend for this without having workload unit expensive recurring workflows. If you can help me figure out a solution that would be amazing!

I know about that, I’m talking about when the user doesn’t click the log out button and just either:

  1. They close the browser tab
  2. They navigate to a different website from your app
    or
  3. If you just want them to reauthenticate themselves after lets say a week of online time?

Through my testing, when I’m logged in, I can jump to Amazon for a sec come back and I’m still logged in… Is there away to detect when the user is no longer on this site period, irrespective of the fact he logs out as he should

What’s the use case?

That exactly what I’m also looking to do, but haven’t figure out a way… what about a timer that kicks the user out after a certain period of inactiveness…

Hi George,

Sorry for the late reply, just wondering if there is a method to log the user out if the user doesn’t log himself out…

Have any ideas?