question

scottadams avatar image
scottadams asked

How to use ListMultiplayerServers in a game client

I am trying to get a list of all current multiplayer servers in a region from a game client.

I can get the title data and access all the server and client functions fine.

But when in the client I use ListMultiplareServers it return:

Only entities of the following types may call this API: title


Currently the game client is logging in with a dummy playerid.

I am using the UnitySDK and its current along with the GSDK and Playfab API

Thanks for any ideas on this.

game manager
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

scottadams avatar image scottadams commented ·

Ok in case anyone else has this issue this is how I solved it

    /// <summary>
    /// the title entity token
    /// </summary>    
    PlayFab.AuthenticationModels.GetEntityTokenResponse TitleEntityToken;



    void GetTitleEntitytoken()
    {
        var request = new  PlayFab.AuthenticationModels.GetEntityTokenRequest();


        TitleEntityToken = null;


          PlayFabAuthenticationAPI.GetEntityToken(
                request,
                result =>
                {
                   TitleEntityToken = result;


                    Debug.Log($"{Time.fixedTime} GetEntityToken {TitleEntityToken}");
                },
                error =>
                {
                    string theError = error.GenerateErrorReport();
                    Debug.Log($"{Time.fixedTime} Got error GetEntityToken {theError} ");
                }
        );
  
    }
0 Likes 0 ·
Citrus Yan avatar image
Citrus Yan answered

Looks like you are trying to use & access Title_Entity_Token from the client-side, however, this is highly unrecommended since it will potentially expose SecretKey & Title_Entity_Token to the players. Players can use that to abuse your title by modifying some data in its own interest. Therefore, I would recommend that you call ListMultiplayerServers and return the result back to the client from the server-side such as CloudScript: https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/writing-custom-cloudscript

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

scottadams avatar image scottadams commented ·

Thanks @Citrus Yan! I will look into that.

I appreciate the comment and the link.

0 Likes 0 ·
scottadams avatar image
scottadams answered

There is now a client-side API that allows client tokens ListMultiplareServersV2

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Yann LE BLEVEC avatar image Yann LE BLEVEC commented ·

hi @scottadams, I cannot find the V2 into the documentation, could you add the link to it please?

1 Like 1 ·
scottadams avatar image scottadams Yann LE BLEVEC commented ·

Seems it has been removed. It was undocumented. ListMultiPlayerServersV2

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.