Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase: sendSignInLinkToEmail() throws: "The given sign-in provider is disabled for this Firebase project."

Trying to:

import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';

firebase.initializeApp(...);

const auth = firebase.auth();

// I inspected `auth` here to verify that I'm authenticating 
// with the right project where the Email/Password sign-in provider
// is enabled.

auth.createUserWithEmailAndPassword(email, password).then(() => {
  // All fine until here, new user is created.
  auth.sendSignInLinkToEmail(email, {
    url: window.location.href,
    handleCodeInApp: true,
  }).catch(error => {
    // Here, the error below is thrown.
  });
});

throws:

[auth/operation-not-allowed] The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.

Interestingly, this works as expected:

auth.onAuthStateChanged(user => {
  // some logic here, and then:
  user
    .sendEmailVerification()
    .then(() => {
      // email is sent fine
    })
});

Here is a minimal reproducible example that demonstrates the issue. Make sure to change the email address to one that hasn't been used before to see the error above.

What could be the reason for this error?

I'm using [email protected]

like image 605
Misha Moroshko Avatar asked Sep 06 '25 03:09

Misha Moroshko


1 Answers

Email verification is not a provider. That is why you can use it without seeing the operation-not-allowed error. It is only used to verify the email.

Email link sign-in is a method of sign-in and will allow the user to sign in with that email link. The former does not need to be enabled, whereas the latter does. You can enable it following the instructions listed above by Doug.

like image 189
bojeil Avatar answered Sep 07 '25 20:09

bojeil