-
Notifications
You must be signed in to change notification settings - Fork 936
Login persistence lost after upgrading from v8 to v9 #6732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
I have exact same issue since upgrading Firebase from v8.2.3 to v9.13.0 (verified with git bisect) : user from onAuthStateChanged is null. If I try to keep initialization v8 style with compat and use v9 getAuth, new onAuthStateChanged, etc. I get this error :
I guess that it should work if I upgrade all the code to v9 including the initialization (that should be the last step of upgrade), but it is a shame to not benefit from the compat libraries to migrate step by step. PS : after updating the first functions and removing compat from first screens of my App, it works fine with v9. No choice but to update all from now. |
Couple of clarifications:
|
@prameshj Hi, thanks for looking into this.
See #6718 |
@prameshj I upgraded my web app to the same version of v9 as the react app (9.6.11) and the login persistence issue is not there, so it seems to be isolated to react native. I only tried it on a windows PC, so to be thorough I should also try running the web app on a mobile device. The javascript code that interacts with firebase is exactly the same for mobile and browser. I don't have time at the moment to try the v9 modular code in react native. When I do, I will let you know the results. It's not urgent for me because V8 is working fine for me at the moment in react native. However, I do want to migrate to the latest version at some point. |
Thanks for confirming that it is isolated to React Native. Looks like this might be a dup of #6050 |
I confirm that I faced the issue with React Native (Expo). |
@nlarif Thanks for the confirmation. I will upgrade to v9 modular as well. |
I can confirm I am facing this issue in certain Android Google Chrome browsers using the library on a web application |
Anyone still having issues with keeping the user logged in after refreshing the app please see my fix and stack overflow link for this: my issue answered: #7152 stack overflow answer: https://stackoverflow.com/questions/75669669/how-to-persist-firebase-user-auth-on-react-native/75898568#75898568 |
In React Native with the JS SDK on expo you can =>
|
@DellaBitta Yes, it seems to be a dupe of #6050. I have not tried the workaround suggested there. I'm still using V8 for now. |
Hey @tomgiam. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Since there haven't been any recent updates here, I am going to close this issue. @tomgiam if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this. |
Uh oh!
There was an error while loading. Please reload this page.
@dconeybe
[REQUIRED] Describe your environment
Windows 10
"firebase": "8.2.3",
"expo": "^46.0.15",
"react-native": "0.69.6",
upgraded firebase to 9.6.11
[REQUIRED] Describe the problem
Steps to reproduce:
I upgraded the firebase version in my expo (react native) app from V8 to V9 (in compatibility mode) and the login persistence feature no longer works. Now the users need to login to the app after every app launch. Previously it remembered unless one explicitly logged off or a new app version was created.
That feature also works the same way on the web version of the app. In both cases the feature worked without me doing anything special. Now I need to know how to get it back in v9 or I may have to go back to v8.
Relevant Code:
old v8 imports:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/database";
import "firebase/firestore";
import "firebase/functions";
import "firebase/storage";
new v9 imports:
import firebase from "firebase/compat/app";
import "firebase/compat/auth";
import "firebase/compat/database";
import "firebase/compat/firestore";
import "firebase/compat/functions";
import "firebase/compat/storage";
static Login = (email, password, callback) => {
// try {
firebase
.auth()
.signInWithEmailAndPassword(email, password)
.then((res) => {
//console.log(res);
callback({ pass: true, res: res });
})
.catch((error) => {
//console.log(error.message);
callback({ pass: false, res: error });
});
};
The rest of the code is the same except for adding:
db.settings({ experimentalForceLongPolling: true });
The text was updated successfully, but these errors were encountered: