1

我一直在看聚合物峰会上的 Michael Bleigh

当我尝试

observers: ['autoAuth(user, statusKnown)],

autoAuth: function(user, statusKnown) {
  if(statusKnown && !user) {
    this.$.auth.signInAnonymously(); } 
},


signIn: function() {
  let google = new firebase.auth.GoogleAuthProvider();
  this.user.linkWithPopup(google);
}

它在新用户上运行良好,但在旧用户上,我收到凭据已被另一个帐户使用的错误

我该如何解决这个问题

4

1 回答 1

2

试试这个...

observers: ['autoAuth(user, statusKnown)],

autoAuth: function(user, statusKnown) {
  if(statusKnown && (user === null || Object.keys(user).length === 0)) {
    this.$.auth.signInAnonymously(); } 
},


signIn: function() {
  let google = new firebase.auth.GoogleAuthProvider();
  this.user.linkWithPopup(google);
}
于 2017-07-17T18:44:55.577 回答