dr6673999 2014-08-25 21:56
浏览 31
已采纳

验证在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 ?

  • 写回答

1条回答 默认 最新

  • dongzhaoshi8497 2014-08-26 08:42
    关注

    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".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化