gmail - 即使用户没有在 gmail 登录,也获取 "popup closed by user"

标签 gmail angular5 gmail-api

我正在尝试使用 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/

相关文章:

gmail - 如何在独立程序中自动从用户检索 OAuth 代码

angular5 - 模块构建失败 : Error: index. TypeScript 编译中缺少 ts

angular5 - Angular 5.2 & RxJS 5.5 HttpInterceptor retryWhen, but update request?

graph - 使用 Angular 5 创建图表

ruby - 是否可以使用 OmniAuth 获取 Gmail oauth 或 xauth token ?

outlook - 在为事件实现 ICalendar 导出时,应针对哪些客户端?

python-2.7 - httplib2.ServerNotFoundError : Unable to find the server at www. googleapis.com

python - 电子邮件中的 Base64 编码图像

c# - 获取表边框折叠 :collapse to work with StringBuilder sent to Gmail

gmail - 如何使用 Gmail API 访问我拥有的 gmail 帐户?