Control access to services
Restrict direct player access to backend services and only allow updates through trusted server code.
Read time 2 minutesLast updated 18 hours ago
To store a player’s information, you need an identifier for the player. Unity Gaming Services (UGS) requires players to authenticate to access most features for security and identification. The authentication process means that if the same player signs in to your game through the same provider on a new device, the player has the same
playerId- Deny clients writing directly to Cloud Save, but allow reads and queries
- Deny clients writing directly to players inventory or currency in Economy, but allow reads and purchases which are alreay server authoritative.
- Deny clients adding a score to a leaderboard, but allow reads to get leaderboards and leaderboard scores
- Deny clients updating their player name, but allow reading their player name
If there are other services you would like to block client access to, the URNs for each serivce are listed in the Access Control page. For an example of how to use access control, refer to the page on how to Get started with Access Control and Cloud Code.{ "$schema": "https://ugs-config-schemas.unity3d.com/v1/project-access-policy.schema.json", "Statements": [ { "Sid": "deny_access_to_cloud_save_writes", "Action": [ "Write" ], "Effect": "Deny", "Principal": "Player", "Resource": "urn:ugs:cloud-save:/**", "Version": "1.0.0" }, { "Sid": "allow_access_to_cloud_save_queries", "Action": [ "Write" ], "Effect": "Allow", "Principal": "Player", "Resource": "urn:ugs:cloud-save:/**/query", "Version": "1.0.1" }, { "Sid": "deny_access_to_economy_writes", "Action": [ "Write" ], "Effect": "Deny", "Principal": "Player", "Resource": "urn:ugs:economy:/**", "Version": "1.0.0" }, { "Sid": "allow_access_to_economy_purchases", "Action": [ "Write" ], "Effect": "Allow", "Principal": "Player", "Resource": "urn:ugs:economy:/**/purchases/*", "Version": "1.0.0" }, { "Sid": "deny_access_to_leaderboards_add_score", "Action": [ "Write" ], "Effect": "Deny", "Principal": "Player", "Resource": "urn:ugs:leaderboards:/v1/projects/*/leaderboards/*/scores/players/*", "Version": "1.0.0" }, { "Sid": "deny_access_to_player_name_updates", "Action": [ "Write" ], "Effect": "Deny", "Principal": "Player", "Resource": "urn:ugs:social:/v1/names/*", "Version": "1.0.0" } ]}