constructor()

in sample/authui/src/app/firebaseui.component.ts [140:186]


  constructor() {
    // Fetch configuration via reserved Firebase Hosting URL.
    fetch('/__/firebase/init.json').then((response) => {
      return response.json();
    }).then((config) => {
      const configs = {};
      configs[config.apiKey] = {
        authDomain: config.authDomain,
        callbacks: {
          // The callback to trigger when the tenant selection page
          // is shown.
          selectTenantUiShown: () => {
            this.title = 'Select Employer';
          },
          // The callback to trigger when the tenant selection page
          // is hidden.
          selectTenantUiHidden: () => {
            this.title = null;
          },
          // The callback to trigger when the sign-in page
          // is shown.
          signInUiShown: (tenantId) => {
            const configKey = tenantId ? tenantId : '_';
            this.title = tenantsConfig[configKey].displayName;
          },
          beforeSignInSuccess: (user) => {
            // Do additional processing on user before sign-in is
            // complete.
            return Promise.resolve(user);
          },
        },
        displayMode: 'optionsFirst',
        // The terms of service URL and privacy policy URL for the page
        // where the user selects a tenant or enters an email for tenant/provider
        // matching.
        tosUrl: '/tos',
        privacyPolicyUrl: '/privacypolicy',
        tenants: tenantsConfig,
      };
      // This will handle the underlying handshake for sign-in, sign-out,
      // token refresh, safe redirect to callback URL, etc.
      const handler = new firebaseui.auth.FirebaseUiHandler(
          '#firebaseui-container', configs);
      const ciapInstance = new ciap.Authentication(handler);
      ciapInstance.start();
    });
  }