The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

2020-08-18 16:40:05

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?


2020-08-20 10:37:07

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).

2020-08-20 22:11:01

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.

2020-08-21 15:17:29

Have a look at this page about Hacking Counters:

If you build a plugin, you can disconnect users (but have to make sure nobody else does).
You should use an account system which can ban users via authentication. Else, the hacker will simply reconnect.

Back to top