several of connections per one user

How to disconnect the user when it comes to two clients with the same account? [Photon Cloud]


  • Tobias
    You need to use Custom Authentication to avoid a second login of the same user. That is the only option with the Photon Cloud.
  • maksimov
    How does this help?
    I added Custom Authentication. But, as before, the user can connect to the server with multiple clients simultaneously.
  • TopTor
    There is an example of how to solve this problem?
  • Tobias
    I was wrong. Custom Authentication can't really help you with multiple login, as it doesn't get a notification when a user disconnected.
    A very bad solution would be to implement a timeout. If a user authenticated, save the timestamp and disallow login for X seconds.

    I will ask Philip, our server guy if he sees any solution.
  • rstorm000
    Any update on this? Couldn't you use the friends list to check for the same username signed on? It would need to not check your current client in this case for this to work.

    Edit: Shouldn't there be some sort of unique ID number per friend? So if

    friend username is your username

    friend.IsOnline and friend.ID != my.ID then it's someone logged in with the same username but a different unique ID.
  • Tobias
    The userID is supposed to be unique. We don't apply another ID to them and we don't even make sure if a user actually IS unique.
    The system is relaxed about this (maybe too much for some cases) but simple to use.

    We discussed the "disconnect some user when another tries to login with the account" topic and came to the conclusion that we can't solve it in the near future.
    We want to keep Photon simple and there is a plethora of different rules for this case: You might want to disconnect the other user, someone else might reject the new one, etc, and then there are all sorts of timers needed, a session and we need to be able to find any player anytime to disconnect it. Even if the client currently switches servers.
    We don't want to implement all possibly needed options and we see a problem with the complexity of configuring this.

    We also think, the problem itself doesn't really happen that much. Unless you switch devices a lot, usually your account should be yours and not publicly known. If it gets known, you want to keep users from logging in, instead of kicking you out and using your stuff.

    I'd create some "device ID" per device (store it on the device) and per account on each client. When a user auths, send and check the ID, too.
    You can reject users when 2 other devices logged in in the last 10 minutes and still a user who got disconnected can authenticate just fine if the device ID is one of the 2 "active" ones.
    This can be done with Custom Auth Scripts, as example. Anything more complicated could be coded in Photon Server, which has the LoadBalancing Application as basis for you to modify and extend.

    I'm sorry I couldn't present an out of the box solution here. We just can't "do it all".
  • In unity There's an option for your game options that only 1 client can run on a single computer
  • Sarath
    edited July 2022


    Please help me in how to disconnect the existing user when he login from another device.

    I mean auto logout from other device

  • Meep
    Meep ✭✭✭

    You need server logic (Photon plugins), the server provides nothing for this when they have already generated their Photon token

  • Sarath

    how to disconnect the existing user when he login from another device with the same credentials.

  • _mra

    same problemm

    its published exploit by hackers that just make 100000 connections with same id on PUN and players cant connect anymore = photon should fix this