How can I validate the mail domain before authenticating with google on firebase?

1

I'm trying to log in with google in firebase and I do not believe user if the mail does not have a specific domain like @ example.com, I do not know if this can be done with the functions of firebase, I have not found a method of authentication that does that

    
asked by Yhoshua Ochoa 13.04.2018 в 00:14
source

1 answer

1

You would have to validate it with a regular expression or with a manual validation of the variable with your mail chain, firebase only supports you in that it is a valid email. In the following reference you only mention the error "auth / invalid-email" link

This example is using string validation:

var idx = correo.indexOf('@yahoo.com');
if (idx > -1) {
  // verdadero si contiene yahoo.com
}

Example reference: link

    
answered by 30.04.2018 в 18:37