更新时间:2023-09-12 11:38:52
云函数应该具有一个名为所有用户"的成员角色,以便无论授权如何,都可以从任何地方/任何人调用此函数.
Cloud function should have a role with member called "All users" to invoke this function from anywhere/anyone irrespective of an authorization.
未经授权:
获得授权:
在云功能上设置授权始终是一个好习惯
It's always a good practice to set authorization on your cloud functions
注意:授权用户应调用"403禁止-您的客户端无权获取URL"引发的云函数错误.
Note: Cloud functions throwing error with "403 Forbidden - Your client does not have permission to get URL" should be called by authorized users.
简单测试:
单击顶部的Cloud shell(图标)终端
Click on Cloud shell(icon) terminal in the top
类型-gcloud auth打印身份令牌
type - gcloud auth print-identity-token
复制生成的令牌
形成调用云函数时要传递的授权密钥 4.1授权:不记名的generate_token
forming Authorization key to be passed while calling cloud function 4.1 Authorization: bearer generated_token
在调用您的云函数时使用上面的授权密钥
Use above Authorization key while calling your cloud function
注意: