简体   繁体   English

Firebase身份验证不是功能

[英]Firebase auth reauthenticate is not a function

I am getting a : 我得到了:

Uncaught TypeError: user.reauthenticate is not a function 未捕获的TypeError:user.reauthenticate不是函数

with this code below. 下面的代码。

var user = firebase.auth().currentUser;
var credentials = firebase.auth.EmailAuthProvider.credential(user.email,'foo');

console.log(user) // the currentUser object
console.log(user.reauthenticate) // undefined    

user.reauthenticate(credentials)
    .then(() => {
        // Do something
    }, err => console.log(error));

I just followed this guide and this accepted answer by Frank van Puffelen . 我只是按照本指南Frank Van Puffelen的 接受答案进行操作

firebaser here 在这里放火

We made a breaking change in the 4.0 version of the Firebase Web SDK. 我们在Firebase Web SDK的4.0版本中进行了重大更改。 From the release notes : 发行说明中

BREAKING: firebase.User.prototype.reauthenticate has been removed in favor of firebase.User.prototype.reauthenticateWithCredential . BREAKING: firebase.User.prototype.reauthenticate已被删除,转而使用firebase.User.prototype.reauthenticateWithCredential

As far as I can tell the reauthenticateWithCredential is a drop-in replacement for the old method. 据我所知, reauthenticateWithCredential是旧方法的替代品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM