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.68k stars 3.97k forks source link

[firebase_auth: 5.3.1]: Multi-Tenancy Authentication Fails with [firebase_auth/unknown-error] An internal error has occurred when Setting auth.tenantId #13500

Open itsthemanish opened 1 week ago

itsthemanish commented 1 week ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Windows

Description

I'm experiencing an error when using Firebase Authentication with multi-tenancy in my Flutter application. When setting the tenantId for authentication, the following error occurs:

[firebase_auth/unknown-error] An internal error has occurred

However, if I use the default authentication setup (without specifying a tenantId), it works as expected.

Reproducing the issue

  1. Configure Firebase Authentication with multi-tenancy in the Firebase Console, creating multiple tenants and enabling relevant providers.
  2. Set up firebase_auth in the Flutter application.
  3. Attempt to authenticate with a specific tenantId as follows:
    auth.tenantId = tenantId;
    auth.signInWithEmailAndPassword(email: email, password: pwd));
  4. Observe the error message [firebase_auth/unknown-error] An internal error has occurred.

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```

Additional context and comments

No response

SelaseKay commented 1 week ago

Kindly provide a complete minimal reproducible code

itsthemanish commented 1 week ago

I'll provide the minimal reproducible code shortly.

I've discovered that FirebaseAuth.instance.tenantId = tenantId; is not setting the tenant ID on Windows; it continues to use the default tenant ID instead.

itsthemanish commented 1 week ago

It seems that firebase_auth for Windows may lack full support for multi-tenancy, specifically in setting the tenantId. As a result, FirebaseAuth.instance.tenantId might default to the primary tenant on Windows, rather than switching to a specified tenant ID.

SelaseKay commented 1 week ago

cc @Lyokone

itsthemanish commented 2 days ago

@Lyokone @SelaseKay Please let me know if anything is needed from my side.

ZiyadF296 commented 1 day ago

I am experiencing the same issue on Windows as well.