You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firebase auth isn't being restored on web after page refresh. When I authorise, everything works correctly, and FirebaseAuth.instance.currentUser is also present. However, when I refresh the page, I never receive update that user is authorised, and FirebaseAuth.instance.currentUser is always null.
Steps to reproduce
Steps to reproduce the behavior:
Do authorisation (as in example project)
Observe that FirebaseAuth.instance.currentUser is not null after authorisation
Refresh page (just F5 will work)
Observe the issue
Expected behavior
After refresh, FirebaseAuth.instance.currentUser should be not null after some time, FirebaseAuth.instance.authStateChanges also should send some update after some time that user is authorised
Everything works well on mobile, only web.
I do notice that auth cache is present in local storage. So my assumption is that it's not being restored.
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en-DE)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.4)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
@dmi3coder there's a similar issue open describing your case, #9089, so please follow-up in it for further updates. There's an active PR to fix this issue that you can subscribe to: #9138
Closing this as a duplicate.
Bug report
Describe the bug
Firebase auth isn't being restored on web after page refresh. When I authorise, everything works correctly, and
FirebaseAuth.instance.currentUser
is also present. However, when I refresh the page, I never receive update that user is authorised, andFirebaseAuth.instance.currentUser
is always null.Steps to reproduce
Steps to reproduce the behavior:
FirebaseAuth.instance.currentUser
is not null after authorisationExpected behavior
After refresh,
FirebaseAuth.instance.currentUser
should be not null after some time,FirebaseAuth.instance.authStateChanges
also should send some update after some time that user is authorisedSample project
https://github.com/dmi3coder/flutter_firebase_web_auth_bug
Additional context
Everything works well on mobile, only web.
I do notice that auth cache is present in local storage. So my assumption is that it's not being restored.
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: