When I try to create a new user for my Android app using Email/Password sign-in provider, Firebase Authentication throws:
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. [ Please verify the new email before changing email] " error
Even though Email/Password sign-in provider is enabled for the project.
However, if I create a new user for Email/Password sign-in provider via the Firebase console, this user is then able to login into the app using those credentials.
The app first lets the user use the app as an anonymous user, later when you create an account, the anonymous account is linked with the new credentials.
The code for linking accounts is as follows:
class AccountServiceImpl @Inject constructor(private val auth: FirebaseAuth){
suspend fun linkAccount(email: String, password: String){
val credential = EmailAuthProvider.getCredential(email, password)
auth.currentUser!!.linkWithCredential(credential).await()
}
}
Stack trace for the error obtained via Firebase Crashlytics dashboard
Non-fatal Exception: com.google.firebase.auth.FirebaseAuthException: 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. [ Please verify the new email before changing email. ]
at com.google.android.gms.internal.firebase-auth-api.zzace.zza(com.google.firebase:firebase-auth@@22.2.0:39)
at com.google.android.gms.internal.firebase-auth-api.zzadd.zza(com.google.firebase:firebase-auth@@22.2.0:21)
at com.google.android.gms.internal.firebase-auth-api.zzact.zza(com.google.firebase:firebase-auth@@22.2.0:35)
at com.google.android.gms.internal.firebase-auth-api.zzacv.zza(com.google.firebase:firebase-auth@@22.2.0:75)
at com.google.android.gms.internal.firebase-auth-api.zzacc.zza(com.google.firebase:firebase-auth@@22.2.0:46)
at com.google.android.gms.internal.firebase-auth-api.zzyz.zza(com.google.firebase:firebase-auth@@22.2.0:3)
at com.google.android.gms.internal.firebase-auth-api.zzys.zza(com.google.firebase:firebase-auth@@22.2.0:2)
at com.google.android.gms.internal.firebase-auth-api.zzadi.zza(com.google.firebase:firebase-auth@@22.2.0:15)
at com.google.android.gms.internal.firebase-auth-api.zzadi.zza(com.google.firebase:firebase-auth@@22.2.0:64)
at com.google.android.gms.internal.firebase-auth-api.zzacp.zza(com.google.firebase:firebase-auth@@22.2.0:99)
at com.google.android.gms.internal.firebase-auth-api.zzyj.zza(com.google.firebase:firebase-auth@@22.2.0:37)
at com.google.android.gms.internal.firebase-auth-api.zzyp.zza(com.google.firebase:firebase-auth@@22.2.0:8)
at com.google.android.gms.internal.firebase-auth-api.zzadi.zza(com.google.firebase:firebase-auth@@22.2.0:20)
at com.google.android.gms.internal.firebase-auth-api.zzadi.zza(com.google.firebase:firebase-auth@@22.2.0:64)
at com.google.android.gms.internal.firebase-auth-api.zzacp.zza(com.google.firebase:firebase-auth@@22.2.0:54)
at com.google.android.gms.internal.firebase-auth-api.zzyj.zza(com.google.firebase:firebase-auth@@22.2.0:29)
at com.google.android.gms.internal.firebase-auth-api.zzyz.zza(com.google.firebase:firebase-auth@@22.2.0:11)
at com.google.android.gms.internal.firebase-auth-api.zzyj.zza(com.google.firebase:firebase-auth@@22.2.0:84)
at com.google.android.gms.internal.firebase-auth-api.zzyj.zzb(com.google.firebase:firebase-auth@@22.2.0:134)
at com.google.android.gms.internal.firebase-auth-api.zzacb.zza(com.google.firebase:firebase-auth@@22.2.0:110)
at com.google.android.gms.internal.firebase-auth-api.zzaas.zza(com.google.firebase:firebase-auth@@22.2.0:17)
at com.google.android.gms.internal.firebase-auth-api.zzadf.run(com.google.firebase:firebase-auth@@22.2.0:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4)
at java.lang.Thread.run(Thread.java:919)
2
Answers
This behavior change is due to the Email Enumeration protection feature that is enabled by default on new projects (created on or after Sep 15). There is an option to disable the feature, in case your app relies on this functionality.
On your Firebase dashboard go to: Authentication > Settings > User Actions > Email enumeration protection
Disable Email enumeration protection.
For more details on the issue check out the GitHub issue here
In the error message, there is also specified that:
So before linking the user with credentials, verify the email first.