当前用户权限不足 google api

The current user has insufficient permissions google api

我正在尝试在我的服务器端验证 google 应用程序订阅。

在我看来,我需要为此创建一个服务帐户。

我已经有一个 "OldProject" 链接到我的 google 游戏帐户,所以现在,我在整个 "owner role" 项目 "OldProject" 下创建了一个服务帐户项目。

但出于某种原因,当我使用此服务帐户并尝试验证 purchaseToken 时,出现错误 "The current user has insufficient permissions to perform the requested operation"。

我正在使用此处的 PHP 验证器 https://github.com/aporat/store-receipt-validator

但是我一直收到这个错误

    got error = { "error": { "errors": [ 
{ "domain": "androidpublisher", 
"reason": "permissionDenied",
 "message": "The current user has insufficient permissions to perform the requested operation." } ], 
"code": 401, "message": "The current user has insufficient permissions to perform the requested operation." } }

并且在 API 访问中是,我已授予此用户在所有应用程序上的 "Administrator" 权限

这是 PHP 代码

<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

$root = realpath(dirname(dirname(__FILE__)));
$library = "$root/library";

$path = array($library, get_include_path());
set_include_path(implode(PATH_SEPARATOR, $path));

require_once $root . '/vendor/autoload.php';

use ReceiptValidator\GooglePlay\Validator as PlayValidator;

// google authencation 
$applicationName = 'xxx-xxx';
$scope = ['https://www.googleapis.com/auth/androidpublisher'];
$configLocation = 'googleapi.json';

// receipt data
$packageName = 'com.xxxx.xxxx';
$productId = 'xxx';
$purchaseToken = 'xxxx';

$googleClient = new \Google_Client();
$googleClient->setScopes([\Google_Service_AndroidPublisher::ANDROIDPUBLISHER]);
$googleClient->setApplicationName($applicationName);
$googleClient->setAuthConfig($configLocation);

$googleAndroidPublisher = new \Google_Service_AndroidPublisher($googleClient);
$validator = new \ReceiptValidator\GooglePlay\Validator($googleAndroidPublisher);

try {
  $response = $validator->setPackageName($packageName)
      ->setProductId($productId)
      ->setPurchaseToken($purchaseToken)
      ->validateSubscription();
} catch (\Exception $e){
  var_dump($e->getMessage());
  // example message: Error calling GET ....: (404) Product not found for this application.
}
// success

所以不得不等待超过 24 小时(在我的情况下是 37 小时)它开始工作......感谢 google 浪费我的时间而不是写我们必须等待它更新