onError = function(error) {
    // Ignore error if cancelled by the client.
    if (error['name'] && error['name'] == 'cancel') {
      return;
    }
    // Check if the error was due to an expired credential.
    // This may happen in the email mismatch case where the user waits more
    // than an hour and then proceeds to sign in with the expired credential.
    // Display the relevant error message in this case and return the user to
    // the sign-in start page.
    if (firebaseui.auth.widget.handler.common.isCredentialExpired(error)) {
      var container = component.getContainer();
      // Dispose any existing component.
      component.dispose();
      // Call widget sign-in start handler with the expired credential error.
      firebaseui.auth.widget.handler.common.handleSignInStart(
          app,
          container,
          undefined,
          firebaseui.auth.soy2.strings.errorExpiredCredential().toString());
    } else {
      var errorMessage = (error && error['message']) || '';
      if (error['code']) {
        // Firebase Auth error.
        // Errors thrown by anonymous upgrade should not be displayed in
        // info bar.
        if (error['code'] == 'auth/email-already-in-use' ||
            error['code'] == 'auth/credential-already-in-use') {
          return;
        }
        errorMessage =
            firebaseui.auth.widget.handler.common.getErrorMessage(error);
      }
      // Show error message in the info bar.
      component.showInfoBar(errorMessage);
    }
  }
Sets the user as signed in with Auth result. Signs in on external Auth
instance if not already signed in and then invokes
signInSuccessWithAuthResult callback.

@param {firebaseui.auth.AuthUI} app The current FirebaseUI instance whose
    configuration is used and that has a user signed in.
@param {firebaseui.auth.ui.page.Base} component The UI component.
@param {!firebaseui.auth.widget.Config.AuthResult} authResult The Auth
    result, which includes current user, credential to sign in to external
    Auth instance, additional user info and operation type.
@param {boolean=} opt_alreadySignedIn Whether user already signed in on
    external Auth instance. If true, current user on external Auth instance
    should be passed in from Auth result. Should be true for anonymous
    upgrade flow and phone Auth flow since user already logged in on
    external Auth instnace.
@return {!goog.Promise} A promise that resolves on login completion.
@package