问题
I am developing an app with Firebase and I have to register users to the app using email registration method provided by Firebase. I pretty much did well on Email verification and such things, but one problem, I'm encountering is that "how to validate" entered email address?
By validation, I don't mean if its a correct email form, such as blab@blabla.com
pattern, for example Iamsomething@gmail.com
is an invalid email which cant get email verification, although it is perfectly fine in terms of email pattern.
I want to make sure that invalid emails are not registered to authentication database in the first place. How can I solve this problem?
回答1:
You cannot prevent users from creating an account on Firebase Authentication with an email account they don't own.
That is precisely why you'd implement email verification in your app: to you can prevent those users from accessing other resources. For example, you can ensure that only users with a verified email address can access the Firebase Database with:
{
"rules": {
".read": "auth.token.email_verified == true"
}
}
See my answer here for an extended version of that: How do I lock down Firebase Database to any user from a specific (email) domain?
来源:https://stackoverflow.com/questions/41665179/android-firebase-email-validation