I am making a call to the google indexing API for job postings:
private $client;
private $httpClient;
public function initClient($kernel)
{
$this->client = new \Google_Client();
$this->client->setAuthConfig(JSON_KEY_HERE);
$this->client->addScope('https://www.googleapis.com/auth/indexing');
$this->httpClient = $this->client->authorize();
}
public function sendJob()
{
$endpoint = 'https://indexing.googleapis.com/v3/urlNotifications:publish';
$content = "{
\"url\": \"URL_HERE\",
\"type\": \"URL_UPDATED\"
}";
$response = $this->httpClient->post($endpoint, array('body' => $content));
}
When making the call to the API, the response given is '403 - Forbidden' .
Any ideas what this error actually means? I have created the service account correctly but cannot replicate success from my dev enviroment.