User ID Not Set

We are setting up PhotonServer locally but can only connect and join a room once (one player). Any secondary attempts throw the following error:

Operation failed: OperationResponse 226: ReturnCode: -2 (Join failed: UserId is not set, checkUserIdOnJoin=true expects a UserId.)

From what I've read, this is a known issue since last year, and the suggestions have been to send a UserID from the client by setting it before connecting. This shouldn't be a problem because we authenticate users elsewhere and already have unique identifiers we can use. The question is WHERE do we set the UserID needed by Photon? What is the syntax? What class or property is accessed? I can find no documentation that works.

Comments

  • JohnTubeJohnTube mod
    edited January 2018
    Hi @edgrimaldi,

    If you are using PUN then you can send UserID from client using:
    PhotonNetwork.AuthValues = new AuthenticationValues();
    PhotonNetwork.AuthValues.UserId = userId;
    // connect
    or
    PhotonNetwork.AuthValues = new AuthenticationValues(userId);
    // connect
  • Perfect. Thank you.
  • N1warheadN1warhead
    edited March 2018
    Is there some way to just turn off the authentication? Because I have no interest in account management right now. I used to not have this issue, now it just never goes away.

    Right now I'm just generating a random number between -1,000,000 and 1,000,000 and haven't had an issue with it, but still it would be my luck when publishers test my game, it will be that one time it happens and fails to join lol.
  • FIGURED IT OUT, figures, always figure it out after posting.

    For anybody else who just plainly wants to disable it (Unity at least).
    In your Project go to
    Photon Unity Networking > Plugins >PhotonNetwork > LoadBalancingPeer then go to line 145 and change it to false.
  • Hi @N1warhead,

    I don't understand the issue here and neither the workaround.
    And could you please copy the line 145 that you changed?

    Photon needs to identify each user using a unique UserId.
    So a user can have a UserId using one of 3 ways:

    1. Custom authentication: you setup an authentication provider and this provider assign the UserId.
    2. Client sends his own UserId to server.
    3. Server assigns a GUID to the client as UserId.

    Priority: 1 > 2 > 3
    meaning 3 is last resort.

    The client cannot change his UserId during a session after authentication is done.
    Authentication is not optional.
    Custom authentication is.
  • @JohnTube is there somewhere we can see all the disparity between on-prem and cloud?

    From this post: https://forum.photonengine.com/discussion/11164/userid-not-set

    You said: Yes, this is a known issue since Photon Server's version is way behind the one on the cloud

    Can we know what 'way behind' means? Can we have some info on what you guys have planned for On-Prem?
  • JohnTubeJohnTube mod
    edited March 8
    Hi @BillDozer,

    Thank you for choosing Photon!

    is there somewhere we can see all the disparity between on-prem and cloud?
    We will try to document asap.

    Here is a non-exhaustive list:
    Missing Photon Cloud Features in v4.0.29.11263

    - Updating of PlayerTTL and EmptyRoomTTL using properties
    - Delete Null Properties (room option)
    - Broadcast Properties Change (room option)
    - GetCustomRoomList in SQL lobby
    ...

    Known Issues in v4.0.29.11263

    - Server does not return the UserId in case not set by client or auth provider.
    ...


    Can we have some info on what you guys have planned for On-Prem?
    Photon Server is still an important Photon product.
    We will release an updated Photon Server SDK.
    We just don't have an ETA.

    I hope this is enough information.

    If you want to discuss other options for you with Photon Server get in touch via [email protected]
  • @JohnTube thanks! Everything is fine so far, just looking for any show stoppers before we go too far with on-prem. Based on your reply, we'll keep going with Photon and keep an eye out for those server updates.
  • @JohnTube Thanks for all the useful information. Unfortunately, when a player enters a room of mine, I will only see their ActorID and the Room information when breaking it. (I can see this information when breaking this (Visual Studio) in OnPlayerEnteredRoom)

    I'm using a custom PlayFab authentication method where logging in and finding a room works completely fine for me.

    Hope you can help me out with this!
  • Hi @Skittluier,

    Thank you for choosing Photon!

    You should create rooms with RoomOptions.PublishUserId = true for the UserIDs to be exchanged inside rooms.
  • JohnTube said:

    Hi @Skittluier,

    Thank you for choosing Photon!

    You should create rooms with RoomOptions.PublishUserId = true for the UserIDs to be exchanged inside rooms.

    That did it, thanks!
Sign In or Register to comment.