Google 的 reCAPTCHA 是特定于域的,因此当在 Github 的 Electron 应用程序中使用时,它会给出以下错误 ERROR for site owner: Invalid domain for site key
.
可能是因为在 Electron 应用程序中,文件加载了 file:///
协议(protocol),因此在加载验证码时不会发送引用 header 。我正在使用 electron ./
运行应用程序。
有没有在 Electron 应用程序中加载 reCAPTCHA 的解决方案?
最佳答案
我遇到了同样的问题,就像说 user9699066,我不得不使用快速服务器,因为它无法使用 file://
协议(protocol)。
这是我的代码:
const express = require('express');
const server = express();
server.use('/', express.static(__dirname));
const infos = server.listen(0, 'localhost', () => win.loadURL(`http://localhost:${infos.address().port}/dist/index.html`));
然后 reCaptcha 运行良好。
关于electron - 如何在 Electron 应用程序中使用 Google 的 reCAPTCHA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41584833/