public getAuth()

in sample/authui/src/app/app.component.ts [84:98]


  public getAuth(apiKey: string, tenantId: string | null): Auth {
    let auth = null;
    if (apiKey !== this.config.apiKey) {
      throw new Error('Invalid project!');
    }
    try {
      auth = getAuth(getApp(tenantId || undefined));
      // Tenant ID should be already set on initialization below.
    } catch (e) {
      const app = initializeApp(this.config, tenantId || '[DEFAULT]');
      auth = getAuth(app);
      auth.tenantId = tenantId || null;
    }
    return auth;
  }