Ad

FetchSignInMethodsForEmail(email) Is Not A Function

I'm trying to make sure an email exist/ doesn't exist in firebase, but the method I'm trying to use does not seem to work.

This is my current code:

export function checkEmail(email) {
  return dispatch => {
    dispatch(checkEmailRequest());

    return window.firebase
      .auth()
      .fetchSignInMethodsForEmail(email)
      .then(results => {
        dispatch(checkEmailSuccess(results));
      })
      .catch(function(error) {
        dispatch(checkEmailFailed(error));
      });
  };
}

Message: TypeError: window.firebase.auth(...).fetchSignInMethodsForEmail is not a function

Ad

Answer

My first guess is that you're using an older version of the Firebase JavaScript SDK, while fetchSignInMethodsForEmail was introduced in version 6.0. Before that it was called fetchProvidersForEmail. So you'll either have to upgrade to a later version of the SDK, or use the older method.

Ad
source: stackoverflow.com
Ad