question

Jacob Merrette avatar image
Jacob Merrette asked

Client & Server API

Hi,

I am currently working on a project using playfab and discovered that the Server needs to use Server API and Client API is for, well, the clients.

I am wondering is there's a way to know if a function is called by the Server or by a Client? Asking since at the moment I don't seem to find one and it seems that I would need 1 function dedicated for Client and one for Server.

Example of what I would like:

//If Client 
PlayFabClientAPI.GetCatalogItems(request, OnGetCatalogSuccess, OnPlayFabErrorCallback);
//If Server
PlayFabServerAPI.GetCatalogItems(request, OnGetCatalogSuccessAdmin, OnPlayFabErrorCallback);


Context:
I am working on a card game and the Server acts as a referee to make sure everything is legal. The current way that we have our code set-up is both clients and the server want to fetch the catalog from Playfab.

apis
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.

Jacob Merrette avatar image Jacob Merrette commented ·

Note that I have tried to use the documentation, but it is abysmally unclear and half the links leads me to "Page does not exist".

0 Likes 0 ·

1 Answer

·
Ivan Cai avatar image
Ivan Cai answered

For calling client apis, it need sessionticket retrieved from any client login function. For calling server apis, it requires secretkey and execute on something you specify. For server apis, they are used in cloudscript or a dedicated game server. Assuming that games are made in unity, client side can call executecloudscript to call server apis of cloudscript. The difference between client apis and server apis is preventing cheat. Not only does you call server apis to prevent cheat, you also need to add some validation logic on server-side. You can navigate to API Feature in the title settings and to find out whether to allow the customer some operation options. If the doc you mentioned on comment is related to apis, please refer to Server APIs and Client APIs.

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.

RippleYeller avatar image RippleYeller commented ·

Getting this error when using ValidatePlayer method.

This is being run on dedicated server with local multiplayer agent inside docker. Is it possible that the problem is a firewall issue? The client api for logging in on the client side works just fine. Cant seem to get any of the Server api to work.

0 Likes 0 ·
RippleYeller avatar image RippleYeller RippleYeller commented ·

Woops, here is Validate player and the error from server.

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.