Allows ease console setup of Facebook auth, twitter, github, etc where all the user objects look the same
constauth=firebase.auth();auth.signInWithEmailAndPassoword(email,pass);//return a promise where you can resolve that userauth.createUserWithEmailAndPassword(email,pass); //another promiseauth.onAuthStateChanged(firebaseUser=>{});//fires callback on changes, firebaseUser = null when logout
Using the promise
Signup event
Ref Objects
In the cloud, event.data.ref
.child('specificChild')
.set(value) //returns promise
Delta Snapshot
.ref //to get about ref
.changed() //boolean if changed
.val() //to get the actual value there
Getting val
Adding Backend APIS / Cloud Functions
Could do clientside, but like secrets on client?? and write for every platform?? Require the APIS apparently @google-cloud/speech can be require(nodejs right). Then you add listener to upload file and then use api then write to translationed file. So you handle the conversion clientside. Then deploy these
Setup
Need firebase CLI npm install -g firebase-toolsfirebase login
function signUp(email, pass)) {
const promise = auth.createUserWithEmailAndPassword(email, pass);
promise.catch(e => console.log(e.message));
//catch errors but dont do anything on state change just make request
//using promise then would not allow auth changes
}
//SIGNOUT
firebase.auth().signOut();
//handle the auth state changes here
firebase.auth().onAuthStateChanged(firebaseUser => {
if(firebaseUser) {
//logged in
} else {
//not logged in
}
})