Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+16 votes

Does anybody know how to authenticate w Google via Firebase for a specific domain, i.e. @augustana.edu? Thank you so much!

asked in CSC490_Spring2019 by (8 points)

3 Answers

+13 votes

I think I found the solution, and it is for React for anyone who using it:

const provider = new firebase.auth.GoogleAuthProvider()
provider.addScope('email');
provider.setCustomParameters({

'hd': 'augustana.edu'

});

the 'hd' parameter stands for 'hosted domain'

answered by (8 points)
+9 votes

In order to use Google authentication, you will want to setup some stuff. Here is a link with getting the Google Developer Console setup https://www.robinwieruch.de/react-firebase-social-login . From there, when you are handling the sign-in, you need to give the provider. If there is any question, I am available to help get this setup because it took me a while to figure it out. My discord is Brawny#6847 if you need assistance.

answered by (8 points)
+1

Just to remind once again, the link that I provided should only be used for the initial setup outside of React. The tutorial that is presented there in React is outdated and did not work for me.

+7 votes

I think you have to set it up in your security rules on Firebase, refer to this: https://stackoverflow.com/questions/36943350/how-do-i-lock-down-firebase-database-to-any-user-from-a-specific-email-domain

answered by (8 points)
...