试图在ie11中关闭的oAuth2弹出窗口

时间:2019-03-14 22:39:57

标签: angular oauth-2.0 internet-explorer-11

我们有一个Angular 6应用程序,它正在尝试使用oAuth2登录我们的Google帐户。我们正在使用以下代码:

googleLogin() {
// the provider as well as different things the system needs to login the user
const provider = new firebase.auth.GoogleAuthProvider().addScope(
  'https://www.googleapis.com/auth/plus.login '
  + 'https://www.googleapis.com/auth/userinfo.email '
  + 'profile '
  + 'email '
  + 'https://www.googleapis.com/auth/cloud-language '
  + ''
);
return this.oAuthLogin(provider);
}

private oAuthLogin(provider) {
return this.afAuth.auth.signInWithPopup(provider)
  .then((credential) => {
    return this.setUserData(credential.user)
      .then(() => {
        return credential;
      })
      .catch((error) => {
        console.log('An error occured: ' + error);
        throw error;
      });
  }).catch(error => this.handleSignInError(error));
}

this.afAuth.auth是FirestoreAuth的实例。

这应该会弹出一个弹出窗口,允许用户选择一个用于登录的google帐户。但是发生的是弹出窗口出现,并且在它有机会呈现之前,抛出了一个错误,并且另一个弹出窗口显示“您正在查看的网页正试图关闭窗口”。该错误已在上面的catch块中处理,并具有以下属性:

Code: “auth/popup-closed-by-user”
Message: “The popup has been closed by the user before finalizing the operation”

实际上,不是用户试图关闭弹出窗口,而是其他东西。

这仅在运行时(例如11)在我们的本地环境中发生。当我们在Chrome中运行时,则不会发生。当我们在ie 11的开发和生产环境中运行它时,就不会发生。

有人知道发生了什么以及如何解决?谢谢。

0 个答案:

没有答案