firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.7k stars 3.97k forks source link

[FIREBASE_AUTH]: Network AuthError After App Deletion and Reinitialization #13211

Open CodingWill0 opened 2 months ago

CodingWill0 commented 2 months ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Web

Description

Describe the bug

After deleting and reinitializing (same name) a non-default Firebase App, authentication methods (e.g., signInWithEmailAndPassword) fail with a "A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred" error. Login works again when you refresh the page. I tried with different and same FirebaseOptions parameter. Since it works in the first attempt, it doesn't make sense to blame the issue on the FirebaseOptions, since they're the same in the second attempt (after deleting and reinitializing).

Expected behavior

Authentication methods should work correctly after deleting and reinitializing a Firebase app, with the same or different parameters, as it is a new app.

Actual behavior

Authentication methods fail with a network AuthError after deleting and reinitializing the app. A page refresh is required to restore normal functionality.

Reproducing the issue

Steps to reproduce the behavior:

  1. Initialize a non-default Firebase App using Firebase.initializeApp(name: name, options: options);
  2. Successfully authenticate using a method like:
    await firebaseInstance.signInWithEmailAndPassword(email: email, password: password);

    Where firebaseInstance is obtained from:

    final firebaseInstance = await FirebaseAuth.instanceFor(
       app: Firebase.app(name),
    );
  3. Delete the app using await Firebase.app(name).delete();
  4. Reinitialize the app with the same parameters used in step 1.
  5. Attempt to authenticate again using the same method as in step 2. This will fail with the network AuthError.
  6. Refresh the page. Authentication will now work until the app is deleted and reinitialized again.

Firebase Core version

3.3.0

Flutter Version

3.24.1

Relevant Log Output

A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred

Flutter dependencies

No response

Additional context and comments

Tried with normal renderer + wasm, both have the same issue.

SelaseKay commented 2 months ago

Hi @CodingWill0 . Thanks for the report. I'm able to reproduce this on web platform.