更新时间:2023-09-12 12:04:58
云函数应该有一个名为所有用户"的角色,可以从任何地方/任何人调用此函数,而无需考虑授权.
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 Forbidden - Your client does not have permission to get 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(icon) 终端
Click on Cloud shell(icon) terminal in the top
type - gcloud auth print-identity-token
type - gcloud auth print-identity-token
复制生成的令牌
在调用云函数时形成要传递的授权密钥4.1 授权:bearer generated_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
注意: