google-cloud-platform - 如何使用 oauth/jwt 保护我的 http 触发的 GCP 功能?
问题描述
使用 AWS Lambda 和 API Gateway,我可以部署一个使用 http 公开的函数。
使用 Cognito 和 API Gateway,我可以使用 oauth2 和 jwt 令牌保护函数。
使用 GCP 函数和 http-trigger 选项,我可以部署一个使用 http 公开的函数。
是否有一个“GCP Cognito 替代方案”我可以使用 oauth2 和 jwt 令牌来保护我的功能?
我尝试过使用“身份平台”。我可以通过以下方式获取(不是 jwt)令牌: https ://accounts.google.com/o/oauth2/v2/auth?client_id =[my client id]&redirect_uri=[my redirect uri]&response_type=token&scope=openid
但这给了我一个 401: curl -L -v -XGET --header "Authorization: Bearer [the not jwt token]" https://europe-west2-[my project].cloudfunctions.net/my-hello-function "
谢谢 !
解决方案
推荐阅读
- java - 使用 gradle 应用程序插件,如何使用其他任务的参数调用运行任务?
- cassandra - 写入 Cassandra 网络分区节点
- python - django:无法从全局应用程序导入模型
- javascript - 将外部 JS 对象馈入 Vue.js 组件
- python-3.x - subprocess.Popen 仅在终端中工作
- react-native - 使用图像和uri动态设置react native的图像源
- php - 自定义字段的 Smarty PHP 多选
- r - 为纵向数据创建时间轴;使用数据变量进行计算
- html - 如何在 AMP-HTML 页面中加载外部页眉和页脚 HTML
- python - Node JS中Python AES加密/解密代码的实现