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

  • 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
  • JohnTubeJohnTube mod
    edited February 20
    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.
  • DjebediaDjebedia
    edited February 20
    @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:
    <AuthSettings Enabled="true" ClientAuthenticationAllowAnonymous="true">
    <AuthProviders>
    <AuthProvider Name="Custom" AuthenticationType="0"
    AuthUrl="http://192.168.88.38/Auth/client/authenticate"
    RejectIfUnavailable="false" />
    </AuthProviders>
    </AuthSettings>
    And before connecting to master I do this:
     var authVals = new AuthenticationValues();
    authVals.AuthType = CustomAuthenticationType.Custom;
    authVals.AddAuthParameter("userName", userId);
    authVals.AddAuthParameter("token", userId);
    authVals.UserId = userId;
    PhotonNetwork.AuthValues = authVals;
    And my auth service' Authenticate method is like:
    [AcceptVerbs("GET")]
    public Result Authenticate(string userName, string token)
    { new Result { ResultCode = 1 }; }
    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?
  • 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?
  • 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!
Sign In or Register to comment.