简体   繁体   中英

Android Firebase Email Validation

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?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM