Reactjs 发布的Electron应用程序上的Google API:gapi.auth2.ExternallyVisibleError:无效的cookiePolicy

Reactjs 发布的Electron应用程序上的Google API:gapi.auth2.ExternallyVisibleError:无效的cookiePolicy,reactjs,google-api,electron,google-calendar-api,google-auth-library,Reactjs,Google Api,Electron,Google Calendar Api,Google Auth Library,我有一个React+Electron应用程序,使用Google API进行身份验证并获取日历事件列表 API脚本正在加载到我的index.html的头上,并在我的App.js上初始化,如下所示: // Initializes the API client library and sets up sign-in state listeners. initClient() { let gapi = window["gapi"]; let that = this; gap

我有一个React+Electron应用程序,使用Google API进行身份验证并获取日历事件列表

API脚本正在加载到我的
index.html
头上,并在我的
App.js
上初始化,如下所示:

// Initializes the API client library and sets up sign-in state listeners.
  initClient() {
    let gapi = window["gapi"];
    let that = this;

    gapi.load("client", start);

    function start() {
      gapi.client
        .init({
          apiKey: GOOGLE_API_KEY,
          clientId: CLIENT_ID,
          discoveryDocs: [
            "https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"
          ],
          scope: "https://www.googleapis.com/auth/calendar.readonly"
        })
        .then(() => {
          gapi.auth2
            .getAuthInstance()
            .isSignedIn.listen(that.updateSigninStatus);

          that.updateSigninStatus(
            gapi.auth2.getAuthInstance().isSignedIn.get()
          );

          that.setState({
            apiLoaded: true
          });
        });
    }
  }
它在本地环境下运行完全正常,我有一台服务器在运行,但一旦我构建我的Electron应用程序并以“本机”方式运行该应用程序,就会出现以下错误:
gapi.auth2.ExternallyVisibleError:Invalid cookiePolicy

我对API和服务器没有深入的了解,但通过研究,我发现API在“file://”协议下不起作用,电子应用程序就是这样


想法?想法?

你解决过这个问题吗?这个问题有什么更新吗?如果我没弄错的话,我最后不得不在后台启动一个服务器,然后从那里打电话@脱烷醇908