question

MoonHeonYoung avatar image
MoonHeonYoung asked

api access permission???

hello i have a question :)

in unity, for example if there are two sentence PlayFabServerAPI.UpdatePlayerStatistics and PlayFabClientAPI.UpdatePlayerStatistics

which one can i use???

Is PlayFabServerAPI a function that I can call in the game by logging in to the admin account in Unity ??

If so, how do I set up the administrator account ?? Should I do it in the portal?

10 |1200

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

1 Answer

·
Hernando avatar image
Hernando answered
  • in unity, for example if there are two sentence PlayFabServerAPI.UpdatePlayerStatistics and PlayFabClientAPI.UpdatePlayerStatistics which one can i use???

The PlayFabClientAPI is for use from the player client devices. The PlayFabServerAPI is for use in Cloud Script or custom game servers (dedicated servers). The PlayFabServerAPI is for you to use in server-authoritative logic, so that you can update data/stats for players only after making sure the values are legitimate, read and make use of data you don't want to expose to the player (for privacy reasons, or to protect the integrity and security of the game), etc.

We recommend not enabling any players in clients to post their statistics in case of abusive use. It's better to implement this function in CloudScript.

The players can cheat their scores because when you enable to allow the client to post statistics ( [Setting] -> [API Feature] -> [Allow client to post player statistics]).This is off by default for all titles so that players cannot post whatever score they want to.

So, PlayFabServerAPI.UpdatePlayerStatisticsis is a better and more secure way.

  • Is PlayFabServerAPI a function that I can call in the game by logging in to the admin account in Unity ?

ServerAPI calls do not require anyone login. But all calls to the PlayFab serverAPI(or AdminAPI) require Secret keys for authentication. On the Settings -> Secret Keys tab in Game Manager, you will see a your list of keys. And it will be used to set X-Authentication headers for all ServerAPI(or AdminAPI) calls.

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.

MoonHeonYoung avatar image MoonHeonYoung commented ·

Thank you very much for your kind answers! But I also have two questions.

What I understood,

The PlayFabClientAPI is the function that should be used in Unity,

and

The PlayFabServerAPI should be used in the cloud code inside the game manager.

at this point,

What is the Dedicated Server described above?

Is a server like a Playfab??

2.In the screenshots of this tutorial,

This document uses PlayFabServerAPI in Unity c #.

Did not you suggest that you use it only in the cloud code?

And in the cloud code Do not code using the same method as PlayFabServerAPI.xxx.

I really do not understand about this part,

please help me ....

If i can call PlayFabServerAPI from within Unity (As shown in the screenshot)

Why distinguish it from PlayFabClientAPI ??

3. How does processing a function in the server cloud prevent cheating?

If the player calls the cloud function multiple times to maliciously manipulate the stats,

is not this also about cheating?

0 Likes 0 ·
2352352.png (45.9 KiB)
Hernando avatar image Hernando MoonHeonYoung commented ·
  1. A custom game server specifically runs your code. We have a comprehensive tutorial on using custom game servers in PlayFab (including the details on Port usage) here: https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers.
  2. PlayFabServerAPI can be used in the custom game server since it made with Unity3D. Here's a Getting Started Guide that show you how to call PlayFabServerAPI in your server: https://github.com/PlayFab/PlayFabGameServer
  3. Yes, you should use some server-authoritative logic to check the inputs from the client, either in Cloud Script or a custom game server, for security. More information please see:

https://community.playfab.com/questions/19928/best-practice-for-saving-statistics-for-leaderboar.html

https://community.playfab.com/questions/8637/security-on-updating-statistics-from-client-cloud.html

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.