Я хочу аутентифицировать клиента API Google, прежде чем использовать вставку при покупке приложения.
Я пробовал следующее, но это все равно приводит к ошибке.
Код :
<?php
// include your composer dependencies
require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setAuthConfig('client_secret.json');
// You have to add this scope so it knows it is in app billing store
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$client->setRedirectUri($redirect_uri);
if(isset($_GET['code'])) {
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
$client->setAccessToken($token);
}
$service = new Google_Service_AndroidPublisher($client);
$body = new \Google_Service_AndroidPublisher_InAppProduct();
?> ```