-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Flutter Web Firebase Auth User Logged Out On Page Refresh #9117
Comments
Flutter doctor -v [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3) [√] Chrome - develop for the web [!] Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.36) [√] Android Studio (version 2021.2) [√] IntelliJ IDEA Ultimate Edition (version 2022.1) [√] Connected device (4 available) [√] HTTP Host Availability |
I've also been pulling my hair out for three hours now. There's a bunch of discussion of various closely related bugs in previous versions of various libraries, but nothing I've tried os far works. The closest issue I found is this one: but it still doesn't help. My setup:
Not sure what other helpful info I can provide. This has been a very frustrating experience. Please help! Addendum 1: I do set the persistence value immediately before signing in. Don't think this matters a whole lot, but it's the code I ended up with after trying a million things. I am pretty sure, though, that without any call to setPersistence, I didn't have any entry in Local/Session Storage, i.e. it seems that the default is actually
|
My flutter doctor output:
|
I also tried setting the persistence to local manually before logging in like you did to no avail. |
same problem here |
It appears I'll raise a PR using that implementation, there is an issue on the web JS SDK for this bug but it is closed: firebase/firebase-js-sdk#5481 |
This looks to be getting addressed here #9089 |
Sorry I just saw this issue being mentioned as the solution...how do I access this FirebaseAuth.persistenceType() method? I'm sorry if I'm wasting anyone's time, I'm a cs student trying to navigate maintaining a flutter app after 1 class that taught flutter. |
@nitroplr I think we're still waiting for russellwheatley's PR (#9138) to land, which will expose the underlying JS APIs to us in flutter/dart land. At least's what I think is happening. (and once the PR lands, presumably someone needs to bump the version number and release a new version of flutterfire to NPM, which may be a separate process run by someone else) |
Ohh alright, nice. |
I have a project that is about a year and a half old and after some issues with Firebase I changed how I connect to Firebase by using dart pub global activate flutterfire_cli and flutterfire configure. I now initialize the app using
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
The app works fine except for one thing, now after a year and a half of having the login screen bypassed using the default persistence.LOCAL...every time I go to my site I have to re log in and even on page refresh I have to re log in. However, when using the Chrome debugger I do not have to log in after using hot reload. Any help would be very much appreciated as I am completely stumped. Below is my main.dart where I get my landing page as well as relevant log in code.
------------------Log In---------------------
The text was updated successfully, but these errors were encountered: