firebase/flutterfire

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

itsthemanish opened this issue · 7 comments

Is there an existing issue for this?

  • I have searched the existing issues.

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));
  1. 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
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Kindly provide a complete minimal reproducible code

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.

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.

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

I am experiencing the same issue on Windows as well.

@SelaseKay We're still waiting. Is there any alternative approach we can use to enable multi-tenancy on the Windows app?