【发布时间】:2021-01-22 14:53:01
【问题描述】:
我有一个谷歌云功能。我也有一个网络应用程序。我想使用服务帐户验证对云功能的请求。
我有 json 密钥文件。
我知道我必须关注https://cloud.google.com/functions/docs/securing/authenticating#service-to-function。但这导致我进入一个不适用于谷歌云功能的 IAP 页面。
另一个类似的指令在https://developers.google.com/identity/protocols/oauth2/service-account
但如果我遵循 python 库代码,我最终会得到示例代码:
import googleapiclient.discovery
sqladmin = googleapiclient.discovery.build('sqladmin', 'v1beta3', credentials=credentials)
response = sqladmin.instances().list(project='exciting-example-123').execute()
这与调用云函数没有直接关系。
This 问题的答案有点符合我的要求,但使用的是仅适用于测试的调用 API。
另外,我想将此 API 公开给使用另一种技术(如 .net)的多个应用程序。所以我相信对我来说最好的选择是使用 HTTP 方法(在同一页面上给出):
https://developers.google.com/identity/protocols/oauth2/service-account#httprest
但无论我做什么,我都无法正确签名。
任何帮助解决这个问题都将受到高度赞赏,因为过去几天我一直坚持这一点。
【问题讨论】:
标签: google-cloud-functions jwt service-accounts