How to limit active logins ?

This question is too short and too ambiguous.
Please explain and add more details.

hello , i do not want a user to use single login credentials on different systems. To be precise i am providing paid membership live video content, thus i do not want customers to share their passwords to other users and exploit their membership. Therefore i want to limit a subscribed members login sessions to only one machine

Any updates?

Any updates on this? Really need it badly. Thanks!

I also need to apply this restriction!

It depends on what exactly you want to have.
It’s not so clear. You should explain the scenario in details.
What should happen if the same account is used from different devices/browsers on the same time. Should the second one be rejected, should the first one be rejected? Something else?

Thanks J.D. I’m selling Course Videos, and the access is restricted by WixPlans + Role Members. but if the buyer would like to share its username and password, there is no restriction that this account to be used simultaneously by many people, let say for example, in the same area, or company network, or even in different places (e…g reselling the course by his own).

So, I would like to limit concurrent access, getting the Browser Session ID and keep a "Approved Session record (e.g. WixData record) and if another session is detected, force a logout or prompt a warning message or do anything else.

Thank you!

Hi! I have the same trouble…

We are also looking for this. Limit active login one at a time.

I’d try to use wix-realtime to create a user-based channel. Once a user logs in I’ll publish a message to this channel to logout, and only then I’ll subscribe the new logged-in to the channel.
More specifically:
I’d create a user channel collection the contains the follwoing fields:
_id (=channel Id) and userId (that’s equal to the system user Id).
In the site master code I’d add wixusers.onLoagin() handler, that does the following actions:

  1. Get the current user Id,

  2. Call a backend function that retrieves its channel Id

  3. Publish a message to the channel.

  4. (On the front end) on message - wixUsers.logout()

  5. Then subscribe the logged-in user to the channel.

P.S you can also create the channels directly with the userId if you prefer.

I also need this function as soon as possible. Limit to one open session by user. I’m also broadcasting live video content to paying users, but there is the possibility of sharing username and password and having a lot of viewers using one user’s account.

So try using the realtime (see above).

Great!! This sounds just what we are looking for to limit One Active Login only at a time, regardless whether the the current login remains active or the new login replaces the previous one and perform a logout on other devices. Even without caring if the real owner is trying to make simultaneous logins in the same device (browsers, sessions, tabs) or in multiple devices.

Can someone could give us an example of the corvid code to be used by this Wix-realtime API and working with channels to achieve one active session limit?

@info39130 try something like

Front end masterPage.js:

import wixUsers from "wix-users";
import wixRealtime from "wix-realtime";
import {logout} from "backend/logout.jsw"; 
let user = wixUsers.currentUser;
let channel;
if(user.loggedIn){
channel = { name: user.id + "-login-channel" } ; 
setChannel();
}
wixUsers.onLogin(u => {
channel = { name: u.id + "-login-channel" }; 
setChannel();
})
function setChannel() {
logout(channel).then(() => { 
wixRealtime.subscribe(channel, (message, channel) => {
            if(message.payload === "logout"){wixUsers.logout();}
        });
})
}

Backend logout.jsw :

import wixRealtimeBackend from "wix-realtime-backend";
export function logout(channel){
return wixRealtimeBackend.publish(channel, "logout");
}

(Don’t forget the import’s)

I believe what we are all looking for is some sort of authentication from the paying customer. We want them to be able to log in from anywhere and any device, but we also want to know that it is in fact the paying customer and not 50,000 people who got that users login name and password off their Facebook post! Maybe a phone code authentication would work the best. They login the member area and either our wix site or a plugin app calls the paying customers phone with a 6 digit code that they have to type in to verify it’s them. We would need to add a phone number in the members area so we could use that to verify. Anyone have a plugin like that?? haha

I believe what we are all looking for is some sort of authentication from the paying customer. We want them to be able to log in from anywhere and any device, but we also want to know that it is in fact the paying customer and not 50,000 people who got that users login name and password off their Facebook post! Maybe a phone code authentication would work the best. They login the member area and either our wix site or a plugin app calls the paying customers phone with a 6 digit code that they have to type in to verify it’s them. We would need to add a phone number in the members area so we could use that to verify. Anyone have a plugin like that?? haha

Please note that there isn’t any perfect platform.

You can use the Velo Package + Custom Registration Flow(Velo coding) to achieve the SMS [auth.](auth.

https://www.editorx.store/blog/velo-wix-members-2fa-twilio)

[https://www.editorx.store/blog/velo-wix-members-2fa-twilio](auth.

https://www.editorx.store/blog/velo-wix-members-2fa-twilio) ← Search this package in Velo Packages Panel

https://support.wix.com/en/article/velo-working-with-velo-packages

The SMS platform is not free. You have to pay third-party service in order to send SMS