验证在Compute Engine实例上运行的php应用程序以访问GCS

I created a Google Compute Engine (GCE) instance with service account enabled for cloud storage. I have a php app running on that instance which needs to transfer uploaded files to a specific bucket I have in Google Cloud Storage.

The client ID credentials were created with the application type as "Service Account". After that, a json file was automatically generated and downloaded to my pc. The file contains the following:

{
"private_key_id": "111111111111111111111111111111111",
"private_key": "111111111111111111111111111111111",
"client_email": "111111111111111111111111111111111",
"client_id": "111111111111111111111111111111111",
"type": "service_account"
}    

I replaced the actual values with 1s. What I am trying to find out is how to use the above json key file to authenticate my php app for accessing google cloud storage ?

The example provided at this link https://github.com/google/google-api-php-client/blob/master/examples/service-account.php utilizes a key file of a different format (key.p12). Any hints on how to use the json key file that was generated above instead ?

Is there any specific reason why you prefer to use JSON key instead of the P12 key?

If not, when you create the client ID credentials you should be able to download the P12 key.

Please visit https://developers.google.com/storage/docs/authentication#about-the-client-ID to see how the section related to that client ID looks like, there you can download that key clicking on "Generate new P12 key".