如何创建“凭证"? Firebase Web user.reauthenticateWithCredential()方法所需的对象? [英] How to create "credential" object needed by Firebase web user.reauthenticateWithCredential() method?
本文介绍了如何创建“凭证"? Firebase Web user.reauthenticateWithCredential()方法所需的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
新文档:
var user = firebase.auth().currentUser;
var credential;
// Prompt the user to re-provide their sign-in credentials
user.reauthenticateWithCredential(credential).then(function() {
我应该如何创建此credential
对象?
How should I create this credential
object?
我尝试过:
-
reauthenticateWithCredential(email, password)
(类似于登录方法) -
reauthenticateWithCredential({ email, password })
(文档仅提及一个参数)
reauthenticateWithCredential(email, password)
(like the login method)reauthenticateWithCredential({ email, password })
(the docs mention one argument only)
没有运气:(
PS:我不算在新文档中搜索相关信息所浪费的时间...我非常想念神话般的firebase.com文档,但想切换到v3或更高版本的firebase.storage ...
推荐答案
我设法使其正常运行,文档应该更新为包含此文档,以供那些不想在详尽无遗但辛苦工作中花费过多时间的人使用-阅读参考.
I managed to make it work, docs should be updated to include this for who does not want to spend too much time in the exhaustive-but-hard-to-read reference.
创建凭据对象的方式如下:
The credential object is created like so:
const user = firebase.auth().currentUser;
const credential = firebase.auth.EmailAuthProvider.credential(
user.email,
userProvidedPassword
);
// Now you can use that to reauthenticate
user.reauthenticateWithCredential(credential);
这篇关于如何创建“凭证"? Firebase Web user.reauthenticateWithCredential()方法所需的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文