Normally, the email verification has been sent to the user after creating the account using UserCredential userCredential = await FirebaseAuth.instance.createUserWithEmailAndPassword( email: email, password: password, );
in Flutter.
I want to know: is it possible to create a user account in Firebase ,only if the verification is successful?
2
Answers
Yes possible.
check this ant this also.
It’s not possible the way you are describing it. Once you run
createUserWithEmailAndPassword
, that account is created.What you can do instead is write some code using the Firebase Admin SDK to periodically delete the accounts that were never verified after they have been unverified for some amount of time. Perhaps you could use a scheduled function to run this sort of process daily. You shouldn’t depend on running this logic in the client app since you have no guarantee that it will continue to run after the account is created.
Also consider using an email link to create the user account, as you can bundle the creation of the account with email verification in one call.