flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

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

Open itsthemanish opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] 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

itsthemanish avatar Oct 14 '24 09:10 itsthemanish

Kindly provide a complete minimal reproducible code

SelaseKay avatar Oct 14 '24 12:10 SelaseKay

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 avatar Oct 15 '24 08:10 itsthemanish

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.

itsthemanish avatar Oct 15 '24 08:10 itsthemanish

cc @Lyokone

SelaseKay avatar Oct 16 '24 11:10 SelaseKay

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

itsthemanish avatar Oct 22 '24 16:10 itsthemanish

I am experiencing the same issue on Windows as well.

zedaraf avatar Oct 23 '24 19:10 zedaraf

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

itsthemanish avatar Nov 12 '24 03:11 itsthemanish

@Lyokone My app, VoyageX AI, relies on Firebase multi-tenancy for a Windows ERP. This issue, reported two months ago, is critical for production. Please address it urgently.

itsthemanish avatar Dec 14 '24 04:12 itsthemanish

@itsthemanish I guess its time to consider something like supabase, they clearly dont care, im waiting for years for full windows support and nothing.

o-glethorpe avatar Dec 19 '24 19:12 o-glethorpe

@SelaseKay please update us as our app is currently on hold due to this bug.

itsthemanish avatar Jan 14 '25 06:01 itsthemanish

cc @russellwheatley

SelaseKay avatar Jan 14 '25 11:01 SelaseKay

Hey @itsthemanish - there is no tenantId on the user or auth instance on the Firebase C++ SDK. There is no support for multi-factor authentication.

russellwheatley avatar Jan 14 '25 15:01 russellwheatley