dsfgds4215 2018-10-22 08:45
浏览 1382

为GOOGLE_APPLICATION_CREDENTIALS设置凭据的替代方法

I've a Go app that uses the Google Vision API and Google Video intelligence API. To enter my credentials, I set the environment variable called GOOGLE_APPLICATION_CREDENTIALS. To do so, I assign a file path to this variable that points to the directory where my credentials are stored in.

Problem:

My credentials are not initially saved in a file. Instead they are assigned to a string variable inside my app. As a workaround, I store that value to a temporary file and then assign it's path to GOOGLE_APPLICATION_CREDENTIALS, like described above.

Question:

Is it possible to set API credentials for cloud.google.com/go/vision/apiv1 without this file?

  • 写回答

1条回答 默认 最新

  • dongsu3664 2018-10-22 09:19
    关注

    i do not know how it on Google Vision Api, but for the Google Sheets Api there is such stuff:

    config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/spreadsheets.readonly")
    

    so b is a slice taken from the file credentials.json u can just take it from any other place by yourself

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题