Why photon that's hosted in private sever isn't authenticating users correclty?

krenki
krenki
edited December 2022 in Photon Server

Hello, I am using this line to set credentials for photon from unity PUN 2 plugin:


PhotonNetwork.AuthValues = userIsLoggedIn ? new AuthenticationValues(userId) : null;


Even if userIsLoggedIn is true or false, server returns a non-valid user. User id is set to empty string.


It's worth noting that until today, we used photon public cloud, and everything worked fine, but problem exists only on privately hosted server.


What steps I took to try and fix problem:


- Made sure that I opened all necessary ports on server listed here

- Made sure to copy-paste correctly server URL in unity photon settings

- Set port number to 4530 and Protocol to TCP in unity photon settings

Also, I didn't change anything in photon config JSON file.


Thanks for your time!



EDIT: Could it be because we're using free 100 CCU license? We are not passing 100 CCU limit but probably it's happening because it is not paid license?

Best Answer

  • krenki
    krenki
    Answer ✓

    Nevermind... Found the problem.

    I haven't configured server properly. If you look into this guide about how to start photon server, last section "Game Server IP Config" shows steps how to configure server IP address, which unfortunately don't work, and you have to manually configure IP as described in last sentence: "The Game Server IP Address is saved in "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config". It can be edited manually, too."

    Once you open the file, replace MasterIPAdress and PublicIpAddress with your server IP Adresses.

    Now it should work correctly.


    @chvetsov thanks for support. I appreciate it

Answers

  • hi, @krenki

    what port you are using for initial connection? What userId do you expect?

    did you check server logs in deploy/log folder? remove everything from there. Start photon and reproduce the issue. check logs.

    best,

    ilya

  • krenki
    krenki
    edited December 2022

    Hello @chvetsov , thank you for replying!

    In Unity Config file I am setting region to EU, port to 4530, ip to my server IP and protocol to TCP.


    Connection is established successfully, however when I authenticate user with any of following line of code:

    PhotonNetwork.AuthValues = new AuthenticationValues(userId);//userId is returned from our server and it is guaranteed to be unique, however photon returns user with no id

    //OR

    PhotonNetwork.AuthValues = null; // in this case photon server should assign an id to client but it doesn't

    )

    user connects to server, but user id is set to empty string.


    I cleaned photon logs, then connected from unity, but no log is shown

  • krenki
    krenki
    edited December 2022

    Hello @chvetsov , thanks for replying.


    Please check photon settings in unity:

    To authenticate users I use:

    -if logged in on our server: PhotonNetwork.AuthValues = new AuthenticationValues(userId);//server should return user id to userId passed as parameter, but it returns empty string

    -if not logged in: PhotonNetwork.AuthValues = null;//server should set automatically id for user, but it returns empty string

    Check third log (id = ):

    Also, I tried to get server logs, but no log is saved on server.


    -Krenar

  • hi, @krenki


    if you are using version 5 of sdk you have to use namesever. Set check box below App Version

    best,

    ilya

  • hi @chvetsov , thanks for your answer. I have another error

    When checking User Nameserver toggle, it seems that unity client can't get region list. Any idea?

  • krenki
    krenki
    Answer ✓

    Nevermind... Found the problem.

    I haven't configured server properly. If you look into this guide about how to start photon server, last section "Game Server IP Config" shows steps how to configure server IP address, which unfortunately don't work, and you have to manually configure IP as described in last sentence: "The Game Server IP Address is saved in "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config". It can be edited manually, too."

    Once you open the file, replace MasterIPAdress and PublicIpAddress with your server IP Adresses.

    Now it should work correctly.


    @chvetsov thanks for support. I appreciate it