0
votes

is it possible to make this scenario with Firebase Auth en Firebase Cloud functions?

  • User opens my app and chooses for create account
  • Submits their email adres in the app
  • User is added in Firebase Auth (cloud function?)
  • LoginCode or password is created (cloud function?)
  • LoginCode or password is mailed to the users mail adres (cloud function?)

User submits the LoginCode word password in the app and is authenticated by Firebase Auth.

Is this possible?

The idea is that user must use a valid mail address, otherwise they cannot use the app. Or are there easier ways to do this?

1
I can help for cloud functions side. I can show a minimal NodeJs example if you want.Batuhan

1 Answers

1
votes

Your question is quite broad... but yes all of that is possible. With the Admin SDK (which is used in a Cloud Function), you can, in a unique Cloud Function:

  1. Create a user account with the desired password (including a password that you randomly generate in the Cloud Function if it is what you want): use createUser().
  2. Mail the password when the user creation is completed: See this sample or use the dedicated Extension (by creating a Firestore doc from the Cloud Function)

This Cloud Function can be triggered from the Flutter app (including passing the email to the Cloud Function): see Callable Cloud Functions, here and here.


Note that if your goal is to validate the email addresses, there are other approaches that could be considered, like authenticating through an Email Link or generating an email verification link.


Conclusion: It's up to you to choose the best approach for your case.