Showing notification if/when user logged out of other sessions?

After logging a user out of any other sessions (h/t native Bubble action), I’d like to do one of two things:

  1. Show a notification on the device that’s now logged out and/or
  2. Show a notification on the now logged in device IFF they were logged out elsewhere

For #1, I’ve tried a bunch of things and afaict this just isn’t possible because that session is now gone, and the app isn’t responsive to WFs. Amirite?

For #2, is there a way to know whether [Log out other sessions] actually did any work? i.e., I don’t want to say, “If you were logged in elsewhere, we logged you out” every time. I’d want to show the message selectively.

Thanks for any help.

Do you mean showing a push notification? Or something else? Cause you can add this step right before logging out the user, or send it to a backend workflow and then log out the user

Thanks @Zeroic. Here’s what ended up working for me (see below). Feedback definitely welcome!

What happens if you refresh the page? Wouldn’t that mean that the lastSessionClient is updated and not equal to the lastSessionServer?

As part of my login WF, I always reset sessionClient and sessionServer. So:

  • Device 1 logs in, and the WF assigns the current timestamp value to Client/Server. They can refresh the page, and the same thing happens.
  • Later Device 2 logs in, and the same WF assigns the current timestamp value to Client/Server
  • Now, Client on Device 1 is not the same as Server (because Server = the later timestamp), so Device 1 gets logged out

Ah alright, interesting. Let me know if you come across any limitations on this. I’ll check as well in a few days

Will do. So far it’s been working great!

This topic was automatically closed after 70 days. New replies are no longer allowed.