FirebaseUI-Angular
FirebaseUI-Angular copied to clipboard
How to handle Multi-tenancy ?
Could you please update the document to handle multi-tenancy ?
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);
});
}
}
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.
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?
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);
}
}
}