componentDidMount()

in sample/authui-react/src/components/app.tsx [65:97]


  componentDidMount() {
    // Fetch configuration via reserved Firebase Hosting URL.
    fetch('/__/firebase/init.json').then((response) => {
      return response.json();
    })
    .then((config: any) => {
      this.config = config;
      this.ciapInstance = new ciap.Authentication(this);
      const p = this.ciapInstance.start();
      this.ciapInstance.getOriginalURL().then((originalUrl: string | null) => {
        this.setState({
          navbar: {
            link:  `/${window.location.search}`,
            originalUrl: originalUrl || 'N/A',
          },
        });
      })
      .catch(() => {
        // Suppress getOriginalURL() errors as this currently only works for multi-tenant
        // use case only.
        this.setState({
          navbar: {
            link: `/${window.location.search}`,
            originalUrl:  'N/A',
          },
        });
      });
      return p;
    })
    .catch((error: any) => {
      this.updateError(error);
    });
  }