Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get authorization for accessing Google Play developer API

I am trying to access Google play developer API https://developers.google.com/android-publisher/ to build an inapp purchase product for my company Application.

We have to get authorization to make a GET call to the Google play developer API. https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get

I followed the steps presented here. https://developers.google.com/android-publisher/authorization

enter image description here

Created an Oauth client and and also service account. The gmail account I used was part of the 'Users and permissions' in play.google.com console.

But when I tried to access the API, I got an error enter image description here

As I started searching about this error, I understood that there is something else called 'API Access' in play.google.com. When I tried to access it, All I saw was enter image description here

But I saw in other posts that there exists a screen with details like https://i.stack.imgur.com/Hdjjy.png

So how can I go forward to access API. I did everything as mentioned in documentation of google but it didnt work. Also I dont have access to see the screen of 'API Access'.

Also I am confused, if you can create service accounts from both 'API Access' screen and also from 'credentials' screen in console.developers.com, which one should be used ?

like image 940
africandrogba Avatar asked Sep 24 '18 00:09

africandrogba


2 Answers

Just to check you understand there are a few different APIs to do with in-app purchases.

  • Play billing library is designed to be used in your app. This is what allows users to buy things from your app
  • Configuring in app products. When your app supports in-app products you have to support what the products are and the prices. This is done via the Play console, either manually or in batches uploading CSV files.
  • Finally is the API you refer to in your question. This is not designed for use in your app, and you don't have to use it to support in-app products. Instead this API allows your server (not app) to validate a user's purchase. In order to use this API, you need to enable the "API access" in the page you found. This can only be enabled by the account owner for the Play console, for security reasons. You will need to find the Owner of your Google Play account, and get them to log in and create a service account which has API access.
like image 122
Nick Fortescue Avatar answered Sep 24 '22 13:09

Nick Fortescue


I am able to access it now. I am not the owner of the Google Play console.That was the issue. You just have to go to API Access page and click on "create OAuth Client" or "create Service Account ".

You can use those credentials to access API from postman or through your code.

like image 38
africandrogba Avatar answered Sep 23 '22 13:09

africandrogba