How to disconnect a player if he gets banned on Playfab while connected to game?

edited August 2020 in Lua and Corona
I'm developing a multiplayer game using Photon Realtime and Playfab, and I've made the custom authentication with playfab to prevent users connecting to the game with no authentication.

This way, if a player is banned on Playfab, he won't be able to login to the game anymore, because he won't have the authentication token required to start photon client (unless if he uses a different account and a different IP address),

But if the player is already connected to the game when the banning on Playfab happens, he won't get kicked out of the photon session and will still be able to play untill the moment he logs out. Is there a way to prevent this, so that his photon client would immediately (or shortly after) get the state "Error" and disconnected from the session?

Best Answer


  • Authentication values are usually cached for a reasonable time to avoid having to sync potentially millions of small changes across a wide range of services.

    Your app can talk to the Playfab service anytime you want. If that says the user is banned, simply disconnect from Photon, too.

    If some hacker would prevent this disconnect, the user can stay online until the next time authentication is done (on the Name Server, when the client connects).
  • Thank you for your answer. The hacker preventing the disconnect on the client side was exactly my concern, so I was wondering if there was a way to trigger this action on the server.