[SOLVED]How to allow a user to be connected at 1 place at the time?

Hi,
I figured out that I could create some bugs if I connect the user test:123 on Chrome, then I open my app on Safari and connect again with test:123 because I’m connected in 2 browser and I use a lot of session variables.

How could I handle this ?

You would want to use a combination of Accounts.onLogin and logoutOtherClients

There should be no “bugs” - please elaborate.

but logoutOtherClients log out the other users no ? (if I have read it wrong on the doc I’m going to cry)

No, it should only target the signed in user.

Also, if you look into Meteor.users.findOne().services.resume, you would see all the login tokens for that user. You can just delete the one’s that are not being used.

here the word “bugs” has senses since it’s not linked to my problem. The problem is how to allow the user to be connected from 1 browser at the time it’s not how to resolve theses bugs

I’m going to try and I come back here

Do you want the same user to be able to login on multiple browsers/tabs or do you want to allow only one at a time?

I want that:

user A is logged on Chrome
user B is logged on Chrome then he opens Safari and login on Safari --> it should disconnect B from Chrome but keep A connected

OK - I misunderstood. Follow @msavin’s advice :slight_smile:

1 Like

Worked as a charm ! Thank you for the help