google-app-engine - 通过 Node.js 进行 AppEngine 身份验证
问题描述
我正在尝试编写一个 VSCode 扩展,用户可以使用谷歌帐户登录到谷歌 AppEngine,我需要获取他们的SACSID
cookie 来发出 appengine 请求。
所以我在打开一个浏览器窗口
(由 生成google.appengine.api.users.create_login_url
)
用户登录并被重定向到我的本地网络服务器
localhost:3000/_ah/conflogin/?state={state}
现在我尝试将请求转发到我的 AppEngine 应用程序(因为它知道如何解码 state 参数),所以我请求
基本上只是用实际的应用程序替换 localhost 。
但它不起作用,大概是因为域不同。我认为这是出于安全考虑。
有什么办法可以使这项工作?
解决方案
不理想,但我发现的唯一解决方案是在我的 GAE 实例上设置一个端点来执行重定向。然后我可以将其设置为继续 url,当我开始身份验证过程时
https://accounts.google.com/ServiceLogin?service=ah&passive=true&continue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3D https://my-app.appspot.com/redirect?to =http://localhost:3000
推荐阅读
- xamarin.forms - 如何在 Xamarin Forms 中动态设置 ListView 的 RowHeight
- php - 从日光开始之前保存的偏移量获取当前时区偏移量
- python - Python tkinter 包无法正常运行
- sharepoint - 如何在 Pega 的共享点中创建文件夹时设置元数据(cmis:名称和 cmis:描述)
- laravel - Vue JS 和 Laravel 在同一台服务器上但端口不同(SSL 问题)
- vb.net - ping很多IP
- pingfederate - PingFederate 健康检查自动化
- mongodb - 当我们知道位置时,在猫鼬中更新二维数组
- php - A Database Error Occurred Error Number: 1062 Duplicate entry '5' for key 'PRIMARY'
- javascript - 从具有动态内容的 vuejs 中的方法打开模式