如何在Firebase 3.0中注销用户? [英] How do I sign out users in Firebase 3.0?

查看:61
本文介绍了如何在Firebase 3.0中注销用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档,我强迫用户签名用方法signOut()退出.

According to documentation, I force a user to sign out with the method signOut().

这是我尝试过的:

var rootRef = firebase.database().ref();
var loggedInUser = firebase.auth();

1. firebase.signOut(); 
2. loggedInUser.signOut(); 
3. rootRef.signOut();
4. signOut();
5. firebase.auth.signOut();

以上五个中的每一个我得到... is not a function.我知道我对新Firebase的引用没有问题,因为firebase.database().ref();firebase.auth();不会引发错误.我也已经在控制台中迁移了该应用程序.

I get ... is not a function for every one of the five above. I know there is no issue with my reference to the new Firebase, since firebase.database().ref(); and firebase.auth(); does not throw error. I have also migrated the app in the console.

推荐答案

在JavaScript中,您可以使用以下方式注销用户:

In JavaScript you can sign out the user with:

firebase.auth().signOut().then(function() {
  console.log('Signed Out');
}, function(error) {
  console.error('Sign Out Error', error);
});

这篇关于如何在Firebase 3.0中注销用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆