Removing Player from Your Google Play Games Services Leaderboard
Published: January 19, 2019
I recommend using the Google Play Games Services leaderboard in your Android game. It's fast to get up, it gives you the UI and stores the scores for you. You should set a limit score to avoid cheaters, but you can't set it too low. Because you don't know how good your players will be before you launch. After a while, you see some players have an unnatural score you want to delete. Let me show you how.
Google Play Console
- Go to your Google play console.
- Go to Game services in the left menu.
- Open your game.
- Copy the applicationId for later.
- Click Leaderboard in the left menu. Then copy the leaderboardId for later.
- Go to Linked apps in the left menu.
- Click Link another app and choose web.
- Give it a rememberable name such as «App to remove player score».
- Launch URL doesn’t matter, you can enter:
- Save and continue.
- Authorize your app.
- Open the APIs console by clicking the here in the APIs Console link.
- Go to the tab you opened in the previous step or use this link.
- Click on the web application name you created in Google Play Console step 8.
- Copy the Client ID and Client Secret for later. If you don’t see it you can find it in the DOWNLOAD JSON file.
- Remove the link in the Authorized redirect URIs and add
https://developers.google.com/oauthplayground. N.B. don't end the URL with a slash. Then save.
OAuth 2.0 Playground
- Open the Google Developers OAuth 2.0 Playground.
- Click the settings wheel.
- Check Use your own OAuth credentials checkbox.
- Enter the Client ID and Client Secret from APIs Console step 3.
- On the left side, expand Google Play Game Services Management API v1management and click https://www.googleapis.com/auth/games
- Click Authorize APIs.
- Sign in with your account.
- Click Exchange authorization code for tokens.
- Enter the GET request https://www.googleapis.com/games/v1/leaderboards/leaderboardId/scores/PUBLIC?maxResults=10&timeSpan=all_time and change the leaderboardId with the id you got from Google Play Console step 5.
- Click Send the request.
- Search for the playerId in the response. You will find it under items. Copy the playerId for the players you want to hide from the leaderboard.
- Change HTTP Method to POST.
- Enter the POST request https://www.googleapis.com/games/v1management/applications/applicationId/players/hidden/playerId and change the playerId from step 11 and applicationId from Google Play Console step 4.
- Click Send the request.
There you go, the player will be gone from your leaderboard! If you want, you can clean up by deleting your web app from the Google Play Console and the APIs Console. If you regret your hiding, you can unhide them.