I am using this library: google/cloud-storage
.
In my storage I made a bucket, called: mycustombucket
. My goal is to upload a csv file in that bucket.
Here is my code:
$storage = new StorageClient([
'projectId' => 'my project id',
'keyFile' => json_decode('{
"web":{
"client_id":"my client id",
"project_id":"my project id",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"my auth value",
"client_secret":"my client secret"
}
}', true)
]);
$bucket = $storage->bucket('mycustombucket');
$bucket->upload(
fopen('path/to/my/file.csv', 'r')
);
Unfortunately, I got this error message: json key is missing the type field
. I found this similar POST, but it doesn't work for me. I think it is also outdated.
The content of the JSON, I downloaded it from here:
Would you please suggest me and idea, how to fix this ?
Thank you!