Node webkit和Google OAuth

den*_*xic 5 oauth popup google-authentication node.js node-webkit

刚刚开始使用node webkit,我只是通过iframe加载一个网站来开始...(我知道,很脏但是用两只手和一点时间完成工作).

<iframe src="http://somewebsite.com"></iframe>
Run Code Online (Sandbox Code Playgroud)

问题是,我为该网站登录了Google,这会在网站上创建一个弹出窗口.出于某种原因,它不在node-webkit中,我找不到任何关于启用弹出窗口的文档......

我用于Google登录的代码是他们在网站上提供的默认代码:https: //developers.google.com/accounts/docs/OAuth2Login

我目前没有在node-webkit配置中设置任何令人兴奋的东西:

"window": {
    "toolbar": true,
    "width": 1024,
    "height": 768,
    "min_width": 300,
    "min_height": 300,
    "position": "center",
    "resizable": true,
    "show_in_taskbar": true,
    "icon": "www/resources/img/icon.png"
},
Run Code Online (Sandbox Code Playgroud)

所以我的问题是,如何从iframe启用node-webkit上的弹出窗口以使Google OAuth正常工作?在此先感谢您的帮助.

小智 1

我遇到了同样的问题,并设法通过将节点上下文授权给远程站点来修复它。

只需将node-remote配置项添加到package.json文件中即可。(但请注意,这可能会导致某些库以不同的方式加载,因为它们会检测上下文的变化)。

{
    node-remote : "*" // Or the src url of your iframe
}
Run Code Online (Sandbox Code Playgroud)

之后谷歌登录应该可以正常工作。