Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Firebase Auth强制注销用户?_Javascript_Reactjs_Firebase_Firebase Authentication - Fatal编程技术网

Javascript 如何使用Firebase Auth强制注销用户?

Javascript 如何使用Firebase Auth强制注销用户?,javascript,reactjs,firebase,firebase-authentication,Javascript,Reactjs,Firebase,Firebase Authentication,我正在尝试使用使用Firebase构建的Firebase Auth注销该应用程序。这实际上会注销用户,但无法呈现新页面,并提供以下信息: TypeError: Cannot read property 'push' of undefined 这是我的代码: // sign out const signOut = (history ) => { doSignOut().then(() => {props.history.push(routes.SIGN_IN)}

我正在尝试使用使用Firebase构建的Firebase Auth注销该应用程序。这实际上会注销用户,但无法呈现新页面,并提供以下信息:

TypeError: Cannot read property 'push' of undefined
这是我的代码:

 // sign out
    const signOut = (history ) => {
      doSignOut().then(() => {props.history.push(routes.SIGN_IN)})
    }
    // 
    firestore.collection('customers').doc(userID).collection('subscriptions')
      .where('status', '==', 'trialing' || "active").get()
      .then(activeSubscriptions => {
        // if this is true, the user has no active subscription.
        if (activeSubscriptions.empty === false) {
          console.log("line 31")
          {signOut(props.history)}
        }
      });

有什么想法吗?

firebase.auth.signOut()有什么不管用的地方吗?比如:在那一行执行后,你看到了什么意外行为?@Frankvanpoffelen我实际上用一个更新的错误编辑了我的问题,所以它看起来像
道具。历史记录
未定义。你的意思是说那是
history.push(…)
而不是
props.history.push(…)
?我实际上是导入了一个函数
const signOut=(history)=>{doSignOut()。然后(()=>{props.history.push(routes.SIGN_IN)}
,然后在需要的地方调用这个函数,它就像一个符咒。很高兴听到@Gianluca。你可能想把它作为一个自我回答来结束这篇文章,这样其他人就可以更容易地从你将来学到的东西中获益。