Closed ronlinet closed 4 years ago
I can't add a document into a collection.
$serviceAccount = ServiceAccount::fromJsonFile( storage_path() . '/app/google-services.json'); $firestore = (new Factory) ->withServiceAccount($serviceAccount) ->createFirestore(); $collection = $firestore->collection('alerts'); $doc = $collection->document('name of new document'); $doc->set(['body' => 'est','date' => 'est','image' => 'est','headline' => 'est' ] );
The above code throws open_ssl() error :
In ApiClient.php line 58: openssl_sign(): supplied key param cannot be coerced into a private key In JWT.php line 199: openssl_sign(): supplied key param cannot be coerced into a private
I am using the bellow json format for google-services.json
{ "project_id": "xxxx", "private_key": "xxxx", "client_id": "xxxx", "client_email": "xxx" }
Sorted out by generating the JSON credential file through https://console.cloud.google.com/iam-admin/serviceaccounts instead of https://console.firebase.google.com/u/0/project .
I can't add a document into a collection.
The above code throws open_ssl() error :
I am using the bellow json format for google-services.json