Connect more than one Project ID to Google Play Developer Console

When I try to make a google developer API request. purchases(). products (). get () I am getting 403: projectNotLinked error.

The message tells me: "The project ID used to call the Google Play developer API was not linked in the Google Play developer console."

At this point, I can go to the console, detach the previous project and link it, run the code, and the code works.

However, I cannot completely disable the previous project: I need them both to be linked. How to solve this problem?

I looked around and couldn't find a solution. Tried calling google and they told me they don't support such requests.

Thanks in advance.

+3


source to share


2 answers


Andy's comment is correct, I find the description of LINKED PROJECT in the Google Play Developer Console is confusing at best.

However, I am setting up a company project in the Google Developers Console with the appropriate server and service accounts. It's not perfect, but it works. Then you can assign permission to the required service account in the Google Play Developer Console.

You can also set up just one key and service account if that makes it easier and use them like below in PHP for the server

$service_account_name = 'xxxxxxxxxx-xxxxxxxxxxxxxxx@developer.gserviceaccount.com';
$key_file_location = somedir/keyfile.p12;

$client = new Google_Client();
$client->setApplicationName("GoogleDevelopersConsoleProjectName");
$service = new Google_Service_AndroidPublisher($client);

$key = file_get_contents($key_file_location);
$cred = new Google_Auth_AssertionCredentials(
    $service_account_name,
    array('https://www.googleapis.com/auth/androidpublisher'),
    $key
);

$client->setAssertionCredentials($cred);

if($client->getAuth()->isAccessTokenExpired()) {
  $client->getAuth()->refreshTokenWithAssertion($cred);
}  

$apiKey = "GoogleDevelopersConsoleServerKey";
$client->setDeveloperKey($apiKey);

$package_name = "com.yourcompany.yourappname1";

      

Then all you have to do for another application is change $ package_name.



$package_name = "com.yourcompany.yourappname2";

      

Then using Google Apps for Android subscribers to request a subscription

$service = new Google_Service_AndroidPublisher($client);

$results = $service->purchases_subscriptions->get($package_name,$subscriptionId,$token,array());

      

You can also assign multiple keys, service accounts and other credentials to add other projects to the Google Play developer console.

+2


source


Re-emphasize @andy's comment: There can only be one associated API project .

I spend quite a long time figuring this out. Google documentation doesn't help here.



If you need access to multiple projects / applications, you need to create multiple service accounts within one linked API project and manage access to applications individually.

+4


source







All Articles