Custom autentification failed, invalid parameters. (PUN2)

Options
I was trying to create a simple custom authentication for my game, but every time I send the request to the test domain the invalid parameter error is returned.

Unity code:
AuthenticationValues authValues = new AuthenticationValues();
        authValues.AuthType = CustomAuthenticationType.Custom;
        authValues.AddAuthParameter("username", username);
        authValues.AddAuthParameter("password", pass);
LoadBalancingClient lbc = new LoadBalancingClient();
        lbc.AuthValues = authValues;
PhotonNetwork.ConnectUsingSettings();

PHP web code:
<?php
$pdo = 1;

$pdo = new PDO("mysql:dbname=id16503052_gamea;host=localhost", "id16503052_root","uAL))DLlptEU8FOu");

if(isset($_GET["username"]) && isset($_GET["password"])){

    // username
    $user = $_GET["username"];
    $user_name = addslashes($user);
    
    // passwrod
    $password = $_GET["password"];
    $user_pass = addslashes($password);
    
    $res = array();
    $cmd = $pdo->prepare(
        "SELECT * FROM users
        WHERE username = :u"
    );
    
    $cmd->bindValue(":u", $user_name);
    $cmd->execute();
    
    $res = $cmd->fetchAll(PDO::FETCH_ASSOC);
    
    if ($res[0]['username'] = $user_name) {
        if($user_pass == $res[0]['password']){
            $login_info_success = array(
                "ResultCode" => 1,
                "UserId" => $res[0]['id'],
            );
            
            $json_success = json_encode($login_info_success);
            
            echo $json_success;
        }else{
            $login_info_error = array(
                "ResultCode" => 2,
                "Message" => "Authentication failed. Wrong credentials.",
            );
            $json_error = json_encode($login_info_error);
            echo $json_error;
        }
    }else{
        $login_info_error = array(
        "ResultCode" => 2,
        "Message" => "Authentication failed. Wrong credentials.",
        );
        $json_error = json_encode($login_info_error);
        echo $json_error;
    }
}else{
    $login_info_error = array(
    "ResultCode" => 3,
    "Message" => "invalid Parameters.errrrrrorrrrr?{$_SERVER['QUERY_STRING']}",
    );
    $json_error = json_encode($login_info_error);
    echo $json_error;
}
?>

Comments

  • I managed to solve the problem myself. Briefly, for PUNv2, LoadBalancingClient.authValues should not be used, in fact PhotonNetwork.authValues is used:
    AuthenticationValues authValues = new AuthenticationValues();
            authValues.AuthType = CustomAuthenticationType.Custom;
            authValues.AddAuthParameter("username", username);
            authValues.AddAuthParameter("password", pass);
            PhotonNetwork.AuthValues = authValues;
    
            PhotonNetwork.ConnectUsingSettings();