LoginWithCustomID.
Login encryption is meant to be used for all players after title creation, or not at all. This is not a feature that can be enabled at a later date. You must use it from the very beginning or not at all. In particular, encrypted players will never be able to log in un-encrypted, and non-encrypted players will never be able to become encrypted players.
- Create a player-shared secret.
- Introduce an API Policy rule to enable protection on a certain method.
- Change the client to use a player-shared key to retrieve the public title key and encrypt the payload.
PlayFab makes the following disclaimer: “All of our API calls are already safely encrypted to modern standards, and the standard API call encryption is everything most customers will need. This feature represents an additional layer of security built around making it harder for players to use an unauthorized client. It is not foolproof - it merely increases the difficulty bar for hackers. For most developers, the mild security increase will not be worth the extra effort required.”
Creating a player-shared secret
The PlayFab Admin API exposes a method to manage your player-shared secrets.Creating a new shared secret by a certain name will override the existing key with the same name, if any. In addition, you may have several shared secrets registered under different names.
QC953WQ3TU6ZJTZMAT1FNJQIKR92FPUQTISW4Q6WD8SY841MQQ
Updating the policy
We have a new shared secret created. Now we need to tell PlayFab which API calls to protect. Run the code shown below to protect theLoginWithCustomId API call, and unprotect the rest of the API calls.
Setting up the client
Now when the policy is updated, you are no longer able to just callLoginWithCustomID API. Consider the code shown below.
Not Authorized error (not to be confused with Not Authenticated).
We need to modify the client to properly encrypt the call payload. This is done in 2 steps:
- Use the player-shared secret to fetch the title public key.
- Use the title public key to encrypt the payload.
