안드로이드 앱 APK 업로드 API 연동 관련 팁

2020. 2. 17. 04:41안드로이드 개발

Print apks list of specific packageName using googleapi, androidpublisher and service account authentication (v3).

const {google} = require('googleapis');
const key = require('./privateKey.json')
const packageName = "com.company.example"

let client = new google.auth.JWT(
  key.client_email,
  undefined,
  key.private_key,
  ['https://www.googleapis.com/auth/androidpublisher']
)
const androidApi = google.androidpublisher({
  version: 'v3',
  auth: client
})

async function getApksList() {
    let authorize = await client.authorize();
    //insert edit
    console.log('authorize :', authorize);
    let res = await androidApi.edits.insert({
        packageName: packageName
    })
    //get edit id
    let editId = res.data.id
    const res = await androidApi.edits.apks.list({
        editId: editId,
        packageName: packageName
    });
    console.log(`Result ${(JSON.stringify(res))}`);
}
getApksList().catch(console.error);

https://stackoverflow.com/questions/57566862/unable-to-use-google-play-developer-api-even-after-server-to-server-authenticati

 

Unable to use Google Play Developer API even after server to server authentication

I am trying to call Purchases.Subscriptions: get from my local server, but I am getting an error message saying Error: Login Required. I have already created a service account with a role of Project

stackoverflow.com

 

Google Developer Console

  1. "Google Developer Console" > "APIs & Auth" subcategory "APIs" > (api list) "Google Play Android Developer API". Set "STATUS" to "ON".

  2. "APIs & auth" subcategory "Credentials" > "Create new Client ID". Choose "Service account" and create the id.

  3. You should get a P12 key from the browser.

Google Play Developer Console

  1. "Google Play Developer Console" > "Settings" > subcategory "API access".

  2. Make a link to your "Linked Project".

  3. "Service Account" place may be already showing your "Service account" CLIENT ID which made "google developer console".

By default this account is gray indicating that it is not active. So you must activate it and set authority manually.

You should now get a correct response from the API.

https://stackoverflow.com/questions/25481207/error-the-project-id-used-to-call-the-google-play-developer-api-has-not-been-l

 

Error: 'The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.'

I am getting the following error while accessing Google Play Developer API using a service account: The project id used to call the Google Play Developer API has not been linked in the Google Play

stackoverflow.com