We do login in client side using firebase client library/module import firebase from 'firebase/app'; import 'firebase/auth'; and firebase client key. This client key we get from firebase console in authentication menu. (Its not same as service account key)
Before able to login in client side we have to create user with firebase auth first which is by calling this method firebase.auth().createUserWithEmailAndPassword(email, password)
Once user is created, we will see this user in authentication menu in firebase console.
Now we can login the user firebase.auth().signInWithEmailAndPassword(email, password). With this you will get user info as return value. The user info will contain email , uid and access token.
We send this access token to server.
In the server side , we use firebase admin library/module and service account credentials (need to download from google) to verify this access token with firebase. If it is correct then it will return user info which will have email, uid etc. informatin. Now we know that which user it is and proceed further.
NOTE:
There is two different module , client side and server side (aka admin sdk)
There is two different set of credentials , client have its own , for servicer side have it own
We don't authenticate user using username/password from "server/backend" side like we used to do normally. https://firebase.google.com/docs/auth/web/start
We do login in client side using firebase client library/module
import firebase from 'firebase/app'; import 'firebase/auth';
and firebase client key. This client key we get from firebase console in authentication menu. (Its not same as service account key)Before able to login in client side we have to create user with firebase auth first which is by calling this method
firebase.auth().createUserWithEmailAndPassword(email, password)
Once user is created, we will see this user in authentication menu in firebase console.
Now we can login the user
firebase.auth().signInWithEmailAndPassword(email, password)
. With this you will get user info as return value. The user info will contain email , uid and access token.We send this access token to server.
In the server side , we use firebase admin library/module and service account credentials (need to download from google) to verify this access token with firebase. If it is correct then it will return user info which will have email, uid etc. informatin. Now we know that which user it is and proceed further.
NOTE:
SEO : firebase authentication auth