How do I log a user out from previous devices when they log in on a new one? Realm Apps

Hi all,

I’m developing an iOS app using Realm Sync.
Is there a way to allow a user to be connected to only one device at a time? Meaning that if he has an active session on one device and wants to connect to another device, it will be automatically disconnected from the first one.

Thanks for your help!

1 Like

Wrote something up here that answers a very similar question - Restricting user to login from multiple devices

1 Like

Thanks! I managed to do something similar with push notifications :slight_smile:

Please share your approach.

For each user I store the id of the last device used to connect (let’s call it last_device_id)
When I log in from a device I check if the current device id is the same as last_device_id.
If no, I send a push notification to last_device_id. When the phone receives this notification it logs out from Realm.

1 Like