我已经开发了一个带有google和microsoft oauth登录集成的PWA应用程序。现在我希望PWA应用程序在Windows移动和桌面应用程序中作为Windows PWA应用程序运行,所以我尝试使用AppX注册应用程序,如以下链接中所述,https://blogs.windows.com/msedgedev/2018/02/06/welcoming-progressive-web-apps-edge-windows-10/#R6xvoOyZeLza5oGW.97和在Windows 10操作系统版本中使用PowerShell在开发模式下运行应用程序,微软登录效果很好,但是当我尝试使用谷歌登录时,应用程序开始加载并在一段时间后退出。[显示登录窗口的弹出窗口也没有上来]。
任何人都可以了解正在发生的事情吗?。我研究过但我无法得到任何解决方案。
编辑以下API用于登录google,在客户端[react]
gapi.load('auth2', () => {
this.auth2 = gapi.auth2.init({
client_id: constant.CLIENT_ID,
cookie_policy: 'single_host_origin',
scope: constant.SCOPE,
});
});
loginWithGoogle = () => {
const options = {
scope: constant.SCOPE,
};
options.prompt = 'select_account';
this.provider = 'google';
this.auth2.grantOfflineAccess(options).then((data) => {
this.loginUser(data.code);
});
}
也许是因为你的浏览器的弹出窗口阻止程序,无论如何你可以使用重定向而不是弹出模式,使用ux_mode选项(你必须在OAuth 2.0客户端ID选项上配置重定向URL)
gapi.load('auth2', () => {
this.auth2 = gapi.auth2.init({
ux_mode: 'redirect',
client_id: constant.CLIENT_ID,
cookie_policy: 'single_host_origin',
scope: constant.SCOPE,
});
});