【发布时间】:2017-11-15 23:25:28
【问题描述】:
由于 Firebase 中的 onAuthStateChanged() 函数不接受任何 res/req 参数,window.location 在 Node.js 上也不起作用(因为它是 server-侧代码),如何在身份验证状态更改后重定向到另一个页面?
作为参考,我所拥有的是:
firebase.auth().onAuthStateChanged(firebaseUser=>{
if(user){
window.location = "/profile";
}
});
【问题讨论】:
-
您是为浏览器编写代码还是为 node.js 编写代码?它们是完全不同的环境。
标签: javascript node.js firebase firebase-authentication