Google Play Games API + Playground

The Problem…

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

In the dialog that is opened you have to make sure the Authorized redirect URIs is set to “https://developers.google.com/oauthplayground”  and the Authorized JavaScript Origins is set to “https://developers.google.com”. Make sure those are set properly otherwise this won’t work!

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 :).

 

Google Play Games API + Playground

Google Play Games API + Playground

Menu