Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I call fetchSignInMethodsForEmail() from Firebase Auth

I have a PSK (Polymer Starter Kit) PWA build with polymerfire, I want to call fetchSignInMethodsForEmail() from Firebase Auth. I have tried the following but with error.

firebase.auth().fetchSignInMethodsForEmail(email).then((methods) => {
  // Do something
});

with the error Uncaught TypeError: firebase.auth(...).fetchSignInMethodsForEmail is not a function.

I have tried the following as well with no luck, i.e.

firebase.auth.fetchSignInMethodsForEmail(email);
firebase.$.auth.fetchSignInMethodsForEmail(email); // Assume firebase-auth with id of 'auth'
like image 802
Andrew See Avatar asked Nov 16 '25 14:11

Andrew See


1 Answers

For people using the new modular version it's done like this:

import {  fetchSignInMethodsForEmail } from 'firebase/auth';

    fetchSignInMethodsForEmail(auth, email).then((result) => {
      console.log(result);
    });
like image 179
Jonathan Laliberte Avatar answered Nov 18 '25 08:11

Jonathan Laliberte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!