Reputation: 555
I would like to limit the google authentification to email adresses from 1 domain name.
Example: only people from mydomain.com
can log in. If your email address does not come from that address, you should get an error.
Has someone tried that already ?
Upvotes: 0
Views: 366
Reputation: 30798
If you are using signInWithPopup/Redirect to sign in users with Firebase you can use google OAuth 'hd' custom parameter. Firebase auth javascript API now supports that:
var provider = new firbease.auth.GoogleAuthProvider();
provider.setCustomParameters({
'hd': 'mydomain.com'
});
firebase.auth().signInWithRedirect(provider);
However, users still have the ability to bypass that in Google sign in. You can also double check on sign in completion the domain and firebase.auth().currentUser.delete() if the domain doesn't match and show the relevant error.
Upvotes: 4