I'm following official firestore quick start tutorial here is my code -
use Google\Cloud\Firestore\FirestoreClient;
require 'vendor/autoload.php';
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);
initialize();
function initialize()
{
// Create the Cloud Firestore client
$db = new FirestoreClient();
printf('Created Cloud Firestore client with default project ID.' . PHP_EOL);
$docRef = $db->collection('users')->document('lovelace');
$docRef->set([
'first' => 'Ada',
'last' => 'Lovelace',
'born' => 1815
]);
printf('Added data to the lovelace document in the users collection.' . PHP_EOL);
}
I'm getting this error message Uncaught Google\Cloud\Core\Exception\ServiceException: { "message": "Request had insufficient authentication scopes.", "code": 7, "status": "PERMISSION_DENIED",
My database rules are
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}