我正在使用Firebase Auth和VueJS,我需要将anonymous auth user转换为registered one with Google.
我使用的代码来自一个示例:
fromAnonymousToGoogle: function () {
// Authenticate with the first user then save the currentUser to a local variable
var previousUser = Firebase.auth().currentUser
// Authenticate with a second method and get a credential
var credential = Firebase.auth.GoogleAuthProvider()
previousUser.link(credential)
.catch(function (error) {
// Linking will often fail if the account has already been linked. Handle these cases manually.
alert(error)
})
// OAuth providers authenticate in an asynchronous manner, so you’ll want to perform the link account link in the callback.
// previousUser = Firebase.auth().currentUser;
Firebase.auth().signInWithPopup(new Firebase.auth.GoogleAuthProvider())
.then(function (result) {
return previousUser.link(result.credential)
})
.catch(function (err) {
// Handle error
alert(err)
})
},
我试图将该帐户链接到谷歌时出现此错误:
[Vue warn]:"单击"的事件处理程序出错:"类型错误:this.ta不是函数"
我的代码中没有名为this.ta的函数.如何修复此错误?