Our game has a requirement that every user cannot log in to multiple devices at the same time. In order to achieve this, I use Spark.getPlayer().disconnect(true). The problem with this, is the devices that don't receive SessionTerminatedMessage(because not connected to the internet or other reasons) is still authorized as the user the next time they're connected. I've tried to use Spark.getPlayer().resetAuthTokens() after disconnecting the player, it works but it also affects the current user to be unauthorized.
Any advice to achieve this?
Hi Sean, I'm using both username-password login and the social ones like Facebook. Yes that's exacly what I want.
Hi admin, I don't consider this as an answer, I was just stating what I want to do, and still don't get an answer on how to do it.
One solution you might use to detect the SessesionTerminatedMessage sent when you use disconnect(true) as a push notification instead of through the socket, and tell the player they have been disconnect that way. This might be more complicated than you want, but its the only solution i can think of at the moment.
Sorry i couldn't be more helpful. I will continue to investigate a solution and keep you updated.
It's a shame that there's no easy way round, but I really appreciate your effort, thanks. I'll keep trying to find another solution
we are also running into the same problem. this would seem like a common problem for almost all online games, so i imagine many of us gamesparks developers must also be facing this same problem.
is there any recommended best practice on preventing concurrent logins from the same user?
I'm also interested in a solution, I would like to forbid users to log simultaneously on different devices (as lots of games actually do)...
I just realized I have the same problem, and I am surprised there is not easy way solution to it, since this must be a problem for every single game. Anybody found an easy way how to prevent concurrent logins?
Good news. We've added functionality to prevent this in Cloud Code. You can use "Spark.getPlayer().resetAuthTokens(true)" to reset all auth tokens excluding the latest. Try it and if you have any further questions just let us know.
I think the solution presented is not yet adequate,
2 years and nothing was done
We need this:
Parameter: MULTIPLE LOGIN
Description: case false disable multiple login and return an error when a new device try to login
Key : DETAILS
The player is already logged in, disconnect the other instance and try again