How can I configure leaderboards so that ONLY our Cloud Code modules can write to them but not clients? (I don’t want clients to have direct access to submitting scores themselves, but clients can read from them any time).
Thanks!
How can I configure leaderboards so that ONLY our Cloud Code modules can write to them but not clients? (I don’t want clients to have direct access to submitting scores themselves, but clients can read from them any time).
Thanks!
Hi there!
We have an update to the documentation coming out to clarify how to do this using Access Controls, you can use the UGS CLI - or if using Unity 6, the Deployment window - to deploy Access Control configuration.
We are still working on this documentation but this is a draft version:
To enforce server authoritative game logic and ensure scores are only submitted via a source like a game server or Cloud Code you can use Access Controls to prevent players from directly writing to leaderboards.
Restricting direct write access from game clients is recommended for leaderboards in competitive games.
This example configuration prevent players from writing to any leaderboard:
{
"$schema": "https://ugs-config-schemas.unity3d.com/v1/project-access-policy.schema.json",
"Statements": [
{
"Sid": "LeaderboardAccessControl",
"Action": [
"Write"
],
"Effect": "Deny",
"Principal": "Player",
"Resource": "urn:ugs:leaderboards:*",
"Version": "1.0.0"
}
]
}
This examples shows how to configure a policy that prevents players from writing to a specific leaderboard:
{
"$schema": "https://ugs-config-schemas.unity3d.com/v1/project-access-policy.schema.json",
"Statements": [
{
"Sid": "LeaderboardAccessControl",
"Action": [
"Write"
],
"Effect": "Deny",
"Principal": "Player",
"Resource": "urn:ugs:leaderboards:/v1/projects/{Project ID}/leaderboards/{Leaderboard ID}/scores/players/*",
"Version": "1.0.0"
}
]
}
Note:
Replace{Project ID}
and{Leaderboard ID}
in the above example with your Project ID and Leaderboard ID or specify*
to block write access to all Leaderboards
See Deploying an Access Control configuration for a guide on how to deploy changes to Access Controls.