'getting logged out after every page refresh when using auth.onAuthStateChanged firebase 9
For some reason I am getting logged out of my app on page refresh , I am using the the following logic and I had to disable the unsubscribe thinking it is causing the issue but problem still continues. and I cannot log in unless I use log out function and the sign in back, but if I refresh back to the same loop.
useEffect(() => {
// unsubscribe logic !!
//const unsubscribe =
auth.onAuthStateChanged((user) => {
setCurrentUser(user);
});
//return unsubscribe;
}, []);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
