我正在尝试使用 angular 5 社交登录的 gmail 登录 package它对 facebook 工作正常,但在 gmail 的情况下,它正在打开 gmail 窗口,当用户输入他的详细信息时,他已通过身份验证,但即使它自动关闭,我也会收到错误消息“popup_closed_by_user”。
下面是我的代码:
public socialSignIn(socialPlatform : string) {
let socialPlatformProvider;
if(socialPlatform == "facebook"){
socialPlatformProvider = FacebookLoginProvider.PROVIDER_ID;
}else if(socialPlatform == "google"){
console.log(GoogleLoginProvider.PROVIDER_ID);
socialPlatformProvider = GoogleLoginProvider.PROVIDER_ID;
}
this.socialAuthService.signIn(socialPlatformProvider).then(
(userData) => {
console.log("data from fb is");
console.log(userData);
}
);
}
提前致谢。
最佳答案
尝试 this github forum 中建议的解决方案:
I think the issue you are facing is that the popup is blocked by the browser. You should not call the grant method from within an asynchronous function (i.e. the onSuccess callback). The call to grant must be done synchronously after a user interaction (a click for instance).
不知何故,我在使用隐身模式时注意到了这个错误,但在使用常规浏览模式时却没有。
关于gmail - 即使用户没有在 gmail 登录,也获取 "popup closed by user",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49505572/