AuthSettings

Hi!

I'm trying to handle reconnect routine. I have a player that creates new room, loses connection, reconnects to master and then rejoins the room. Everything goes well with AuthSettings set to true. If AuthSettings is set to false, reconnect goes well and rejoin attempt leads to an error:
Operation failed: OperationResponse 226: ReturnCode: 32746 (Join failed: UserId '00000000-0000-0000-0000-000000000000' already joined the specified game (JoinMode=3).). Parameters: {} Server: GameServer
So what exactly does AuthSettings set to true? Is there any way to rejoin without setting it to true? Maybe there's something I did wrong? Why is UserId equal to '00000000-0000-0000-0000-000000000000'?

P.S. I'm sorry for my English!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Djebedia,

    You are probably setting the same UserId for all clients before connecting.
    You need a unique UserId per user.
    Read more about UserIDs here.
    Read this post on stackoverflow to make sure you create a new different GUID each time.
  • No, UserIDs are different and it doesn't matter since I have the only one player trying to rejoin the room
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Hi @Djebedia,

    This could be an issue on Photon Server only.
    Could you try this on Photon Cloud if possible to make sure?

    Read my post here which contains links to other discussions as well.

    I'm moving this discussion to Photon Server category.
  • Djebedia
    Djebedia
    edited February 2019
    @JohnTube Unfortunately, it's not possible to reproduce it on Photon Cloud :(
    And I've already read those discussions which lead me to enable custom auth since otherwise it's not possible to rejoin the same room (which is weird). And as result everything worked fine, but then I've noticed that enabling AuthSettings worked well only while LoadBalancing is run locally in IDE (I mean not as service). After I've run LoadBalancing as service I got authentication problems:
    Operation failed: OperationResponse 230: ReturnCode: 32767 (Authentication token is missing). Parameters: {} Server: GameServer
    and
    The appId this client sent is unknown on the server (Cloud). Check settings. If using the Cloud, check account.
    I have settings like this:

    <AuthProviders>
    <AuthProvider Name="Custom" AuthenticationType="0"
    AuthUrl="http://192.168.88.38/Auth/client/authenticate"
    RejectIfUnavailable="false" />
    </AuthProviders>
    </AuthSettings><AuthSettings Enabled="true" ClientAuthenticationAllowAnonymous="true">
    And before connecting to master I do this:

    authVals.AuthType = CustomAuthenticationType.Custom;
    authVals.AddAuthParameter("userName", userId);
    authVals.AddAuthParameter("token", userId);
    authVals.UserId = userId;
    PhotonNetwork.AuthValues = authVals; var authVals = new AuthenticationValues();
    And my auth service' Authenticate method is like:

    public Result Authenticate(string userName, string token)
    { new Result { ResultCode = 1 }; }[AcceptVerbs("GET")]
    So I expect that every user will be successfully authorized, and even if there'd be some connection problems with my auth service users won't be rejected anyway.

    But it just doesn't work. What am I doing wrong?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Djebedia,

    You are reporting multiple different issues at once.
    Let's tackle one by one.

    Provide the PUN version you are using.

    Issue 1:
    Operation failed: OperationResponse 226: ReturnCode: 32746 (Join failed: UserId '00000000-0000-0000-0000-000000000000' already joined the specified game (JoinMode=3).). Parameters: {} Server: GameServer

    Issue 2:
    Operation failed: OperationResponse 230: ReturnCode: 32767 (Authentication token is missing). Parameters: {} Server: GameServer

    Issue 3: running Photon Server from IDE (or as application from Photon Control) vs. running Photon Server as a service

    Which issue do you want to discuss first?
  • Hi @JohnTube
    It looks like the main issue is the last one: the differense between running Photon Server from IDE and running it as a service.
    The PUN version is v1.90 (10. April 2018)
  • Hi @JohnTube
    Any news?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Djebedia,

    I'm involving the server team.
    I think when you run Photon Server as a service, configuration files are on a separate location and other things might change as well (working directory, log files, etc.). Not sure I have to verify this.

    You install the service from Photon Control right? or you do it manually?
  • Hi @JohnTube
    Yep, from Photon Control.
  • @JohnTube, it seems like my only problem was correct settings of minimum and maximum timeouts of loadbalancing. After setting it to a smaller values I start recieving OnLeave callback much earlier and there for the player becomes inactive much earlier and there for I stopped recieving those errors from my first message in this discussion. So, I don't need custom authentication anymore and all my problems are solved for now ) Although, I haven't yet figured out how to hadle the custom athentication.
    And thank you very much for your help and attention!