0

I have a Flutter mobile application which uses the Firebase email authentication. Users register themselves by entering username, password, current country and first and last name. When they register, I create a user document under the users collection which will have email as an id, first, last name, country, notification token. However once they verify their email address then only they can use all the features of the app.

My problem is, some users enters junk email address which does not exists. Due to this, I am ending up with having wrong email address in the Authentication as well as in my Firestore user collection too. Also as these are junk email addresses, they will never be able to verify and login.

Right now I have a Firebase scheduler function that deletes these unverified users (older than 30 days) from the Authentication as well as user collection.

I don't want to create any entry in the Firebase authentication as well as in the users collection until and unless the user verifies their email address. Or is there any other way to achieve this?

Thank you

Sam
  • 2,972
  • 6
  • 34
  • 62

1 Answers1

3

One solution is to use Email Link authentication: the account will be created when the user completes the process.

Paul Ruiz (Firebaser) has written a complete article detailing how to implement this option: See the "Email Link (Passwordless Sign-In)" section.

FYI, the equivalent doc for the iOS and Android SDKs can be find here and here.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121