public startSignIn()

in sample/authui/src/app/app.component.ts [132:205]


  public startSignIn(auth: Auth, selectedTenantInfo: ciap.SelectedTenantInfo): Promise<UserCredential> {
    return new Promise((resolve, reject) => {
      this.signIn(
          !!auth.tenantId,
          () => {
            this.updateError(null);
            signInWithRedirect(auth, new (SAMLAuthProvider as any)(SAML_PROVIDER_ID))
              .catch((error) => {
                this.updateError(error);
              });
            return false;
          },
          () => {
            this.updateError(null);
            signInWithRedirect(auth, new GoogleAuthProvider())
              .catch((error) => {
                this.updateError(error);
              });
            return false;
          },
          () => {
            this.updateError(null);
            signInWithRedirect(auth, new FacebookAuthProvider())
              .catch((error) => {
                this.updateError(error);
              });
            return false;
          },
          (email) => {
            this.updateError(null);
            fetchSignInMethodsForEmail(auth, email)
              .then((signInMethods) => {
                if (signInMethods.length) {
                  // Show password sign in.
                  this.signInWithEmail(
                      email,
                      (password) => {
                        this.updateError(null);
                        signInWithEmailAndPassword(auth, email, password)
                          .then((userCredential) => {
                            resolve(userCredential);
                          })
                          .catch((error) => {
                            this.updateError(error);
                          });
                        return false;
                      });
                } else {
                  // Show password sign up.
                  this.signUpWithEmail(
                      email,
                      (displayName, password) => {
                        this.updateError(null);
                        createUserWithEmailAndPassword(auth, email, password)
                          .then((userCredential) => {
                            return updateProfile(userCredential.user, {displayName})
                              .then(() => {
                                resolve(userCredential);
                              });
                          })
                          .catch((error) => {
                            this.updateError(error);
                          });
                        return false;
                      });
                }
              })
              .catch((error) => {
                this.updateError(error);
              });
            return false;
          });
    });
  }