问题描述
我已经使用react-firebaseui与 它工作得很好。经过所有工作后,在一种情况下,当用户不是预期的用户时,我希望从Firebase身份验证中删除该用户。 我使用user.delete来做到这一点,并且效果很好。 唯一的问题是删除后,firebaseUI从屏幕上消失了。我进行了分析,并确定这只是因为firebase的user.delete方法,此后firebaseUI不可见。 细节: 仅使用“ Google”提供程序进行Firebase身份验证。 成功登录后,我要保留在同一页面上。 我正在使用React应用程序。 我的代码如下:
export const AuthView = () => {
var uiConfig = {
callbacks: {
signInSuccessWithAuthResult: function (authResult,redirectUrl) {
console.log("signInSuccessWithAuthResult===",authResult);
return false;
},uiShown: function () {
console.log("google auth done........");
},},signInFlow: "popup",signInOptions: [firebase.auth.GoogleAuthProvider.PROVIDER_ID],};
return (
<StyledFirebaseAuth
uiCallback={(ui) => {
// ui.reset();
// ui.start("#firebaseui_container",uiConfig);
}}
uiConfig={uiConfig}
firebaseAuth={firebase.auth()}
/>
)
}
这将为Google提供程序处理Firebase身份验证。身份验证成功后,我将检查用户的电子邮件ID是否通过我的业务逻辑条件。 如果是,则完成,否则,从身份验证中删除用户并显示错误消息。
export const delCurrentUser = () => {
var user = fbAuth.currentUser;
if (user) {
user
.delete()
.then(function () {
console.log("User deleted.");
})
.catch(function (error) {
console.error("An error happened while deleting user===",error);
});
}
};
恰好在控制台“用户删除”之后。 firebaseUI在屏幕上不可见。 请提出建议。 预先感谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)