public getAuth()

in sample/authui-react/src/components/app.tsx [113:127]


  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 as any;
  }