Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle Multi-tenancy ? #198

Open
florafresco opened this issue May 10, 2023 · 4 comments
Open

How to handle Multi-tenancy ? #198

florafresco opened this issue May 10, 2023 · 4 comments

Comments

@florafresco
Copy link

Could you please update the document to handle multi-tenancy ?

@anisabboud
Copy link

auth.tenantId = '...';  // https://github.com/firebase/firebaseui-web#multi-tenancy-support.

import { Auth, signOut, user } from '@angular/fire/auth';

@Injectable({
  providedIn: 'root'
})
export class AuthService {

  constructor(
    private auth: Auth,
  ) {
    auth.tenantId = '...';  // https://github.com/firebase/firebaseui-web#multi-tenancy-support.

    user(auth).subscribe(user => {
      console.log('[Auth] user:', user);
    });
  }
}

@RaphaelJenni
Copy link
Owner

I'm currently a bit low on time. It is on my todo list, but I cannot give any timeframe. If it is urgent, feel free to create a PR.

@fanyang0356
Copy link

I am also interested in Multi-tenant support, is there any workflow to quickly asign tenantId to somewhere in the code, before the signup/login UI start?

@DaveA-W
Copy link

DaveA-W commented Jun 7, 2024

Using [email protected] our imports are slightly different.
This works for us:

import firebase from 'firebase/compat/app';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { environment } from 'src/environments/environment';

export class AuthState {
  constructor(private angularFireAuth: AngularFireAuth) {
    // https://github.com/firebase/firebaseui-web#multi-tenancy-support
    if (environment.firebase.auth.tenant) {
      firebase.auth().tenantId = environment.firebase.auth.tenant;
      angularFireAuth.tenantId = Promise.resolve(environment.firebase.auth.tenant);
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants