Flutter - FirebaseAuth signInWithEmailAndPassword and any Firestore interaction takes super long or is not returning at all

Viewed 192

I experience the issue, that calling signInWithEmailAndPassword from FirebaseAuth, is not returning or takes super long and the same problem is for Firestore, if I want to fetch some data. For firestore, I got the following message printed out:

"This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend."

But the internet connection is good, I can even stream full hd videos, can surf in the internet or use other apps which are communicating with a backend.

The auth implementation is the same like on the documentation, so nothing custom:

try {
  await FirebaseAuth.instance.signInWithEmailAndPassword(
    email: email,
    password: password
  );
} on FirebaseAuthException catch  (e) {
  print('Failed with error code: ${e.code}');
  print(e.message);
}

Phones:

  • Galaxy A6
  • Galaxy A6 Plus

Flutter:

[✓] Flutter (Channel stable, 2.5.3, on macOS 12.1 21C52 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)

Firebase Auth: 3.3.5

Firebase Core: 1.11.0

Right now, this is a huge problem for me, because I can't login / develop anymore. Other developer on this project, don't have this problem and I don't know what caused this... I tried 3 different networks, including my iphone hotspot and it seems, from time to time, when I switch between the hotspot and the local wlan network, something is triggered and I can login or firestore is returning, or better say, the async Future is returning.

Can you give my any advice, what I can try here or any tip what caused the problem? The phones, are not the newest, but they are certain good enough to handle flutter with firebase. Indeed, the whole app worked on the phones some months ago.

1 Answers

This is not a connection issue all the time, it may also indicate that there may be something that is not allowing the client application to reach the Firestore backend.

From what I've received around. Please try with following:

  1. Check that your applicationId in app/build.gradle matches the package_name key in the google-services.json file you downloaded.
  2. Try to disable antivirus on your device.
  3. Try changing the proxy.
Related