So I wanted to reset my score on one of my google play games here(QuickAZ) and for that I could use Google Play Games API if the user was registered as a tester in the play console. In order to easily authenticate to the service and test the API I used Google’s Playground.
The only thing was that I had the following error:
"Access Not Configured. The API (Google Play Game Services API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
Also another error that I encountered while trying to figure this out was: “redirect_uri_mismatch”
Fixing the problem
Ok so we should take this step by step.
Playground linked app to game services
You have to login to your play store developer console and then go to Game Services -> Select your app and then go to Linked apps.
You now have to link your game with a web app that in fact will be the Playground tool. To do that click on Link another app then select Web.
In the new screen you’ll have to set the app name, you can write down whatever comes to your mind (I gave it QuickAZ Playground for eg.) and then you have to add the following url: “https://developers.google.com/oauthplayground” under Launch url. You can press Save and continue now…
On the next screen just press Authorise your app now …
You can now press Create client. Go to Publishing at the bottom of the screen because we have to publish our changes. Once you get on the Publish screen, you’ll notice a button at the top of the page saying Publish changes, press that button! 😉
Great, this was the first step! Now let’s go further…
Making sure the play services api are linked with our play store account…
While you’re still on the play store console, go to Settings and then API access.
Check if your app API is already linked with your play console account under the Linked Project category and if is not then you have to press the link button. Once the API is linked with your play account, you will notice the Client ID you just generated under Oauth Clients.
Testing the API using google’s Playground tool
One you’ve done what you had to do on the Play Store console side, you can move to Playground.
Here you have to do a small setup first. Press the Settings button at the top right of the page and then check “Use your own OAuth credentials” Now you have to go to google developer console select your play store project and then go to “Credentials” section and look for the web app client you created from the play store console. It should have the same Client ID and also you should find it under “Client ID for web application”.
You have to fill all the data required by the Playground settings panel (OAuth Client ID and OAuth Client secret) with the data you have on your google developer console.
Once you’ve done that you can close the settings popup and start testing a Google play game services API.
NOTE: Every time you will open this page, you have to do this setup before anything else.
Under Step 1 on the left of the page, click “Google Play Game Services API v1” and then select “https://www.googleapis.com/auth/games” and any other API you need/want to test
You can now press Authorize API. The Google account used when doing all these should be added as a tester in google play console on your game!
Once you authorized Playground to use the API, you have to press “Exchange authorization code for tokens”. That will do all the OAuth job for you and you will be able to use the API.
You can now use the “List possible operations” to select a API that you want to use and press “Send the request” button!
This should be all :).
Search In Blog
Want to donate?
Recent Posts: My Android Solutions
If you ever wondered how to read and parse a simple JSON file stored in the assets directory of your Android project, here is a way to do it.
In this tutorial I will create a simple Sectioned RecyclerView that will show 2 sections and a few items in each section and how to move an item from one section to another. Note: For RecyclerView I used AndroidX imports and not android.support.v7.widget.RecyclerView! Setup We need to import the recycler view from AndroidX. The build.gradle…
Recently, I had to add a perfect square CardView and I wanted to achieve this without hardcoding its width and height. I happily discovered the power of ConstraintLayout and this is how I managed to create a perfect square which should work on every dimension. In my project I created a RecyclerView with 2 columns,…