通过Node.js进行AppEngine身份验证

时间:2019-07-19 09:08:27

标签: google-app-engine google-authentication

我正在尝试编写VSCode扩展名,以便用户可以使用Google帐户登录Google AppEngine,并且我需要获取他们的 "build": { "options": { "assets": [ "src/favicon.ico", "src/the/other/folder/assets", "src/assets", { "glob": "**/*", "input": "src/the/other/folder/assets", "output": "./assets" }, { "glob": "**/*", "input": "src/app/modules/error/assets", "output": "./assets" } ], Cookie来发出Appengine请求。

所以我要在

打开浏览器窗口
  

https://accounts.google.com/ServiceLogin?service=ah&passive=true&continue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttp://localhost:3000/

(由SACSID生成)

用户登录并重定向到我的本地Web服务器,网址为

  

localhost:3000 / _ah / conflogin /?state = {state}

现在,我尝试将请求转发到我的AppEngine应用程序(因为它知道如何解码state参数),所以我向

发出请求
  

https://my-app.appspot.com/_ah/conflogin/?state= {state}

基本上只是将localhost替换为实际应用。

但它不起作用,大概是因为域不同。我认为这样做是出于安全考虑。

有什么办法可以使这项工作完成?

2 个答案:

答案 0 :(得分:0)

并不理想,但是我发现的唯一解决方案是在我的GAE实例上具有执行重定向的终结点。然后,当我开始身份验证过程时,可以将其设置为继续网址

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

答案 1 :(得分:-1)

我认为您应该将注意力集中在所使用的协议上,因为已知cookie名称基于http协议(HTTP:ACSID,HTTPS:SACSID),这是安全性的观点,直到现在为止

现在遇到错误将有助于更好地理解该问题。另外,您如何执行对API的调用以及所使用的代码也会有所帮助。

相关问题