Intro to Firebase
Realtime Database and Authentication
BY KRISTIN FERRIER
About Me – Kristin Ferrier
 18+ Years in IT
 Principal Consultant at Ferrier Solutions
 Full stack web developer with specialty and passion for data
 Twitter: @SQLEnergy
 Techlahoma Slack: @EnergyDev
 GitHub: @EnergyDev
What we’ll cover
 Two ways Firebase can help with you build your applications faster
 Firebase Realtime Database
 Firebase Authentication
Firebase Realtime Database and Authentication helping you
build apps faster
Firebase Realtime
Database
Authentication & Data
Android is a trademark of Google LLC.
iOS App
Android
™ App
React
Web
App
Firebase Realtime Database
 Database as a Service (DBaaS) offered by Google
 NoSQL, document database that stores data as JSON objects
Example Data
Data manipulation via JavaScript apps
import database from "../firebase/firebase";
return database.ref(`users/${uid}/expenses`).push(expense).then((ref) => {
dispatch(addExpense({
id: ref.key,
...expense
}));
})
In JavaScript web applications, data is manipulated using JavaScript
The below code is adding an expense to the Firebase realtime database and then adding it to the
Redux store
Validation and Security
 What if someone tries to bypass my front-end application,
how are validation and security handled?
 Database Security Rules within Firebase
Lockdown users to just their data
Lock users down to
just read/write
their data
This is done within
Firebase, so
security is there
even if your front-
end GUI is
bypassed
Please, see official Firebase documentation for the latest in security rule logic.
Data Structure Validation
Lock down
structure of data
saved
This is done within
Firebase, so
validation is there
even if your front-
end GUI is
bypassed
Please, see official Firebase documentation for the latest in security rule logic.
Setup Security !!!!!!!!!!!!!
 Be sure to setup security
 The DEFAULT is Read/Write for EVERYONE!
 Even if they don’t have your database keys, your database can be read
Firebase Authentication
 Provide authentication in your apps using any of the below platforms:
 Email/Password
 Phone
 Google
 Play Games
 Facebook
 Twitter
 Github
 Anonymous
Add in Login Capability with minimal JS
Code
Here’s the login JS (Google auth)
import { firebase, googleAuthProvider } from "../firebase/firebase";
export const startLogin = () => {
return () => {
return firebase.auth().signInWithPopup(googleAuthProvider);
};
};
The Login with Google button calls the startLogin function above
Firebase authentication
 Can integrate with Firebase Realtime Database
 You can use it as a stand alone Firebase feature, as well
Awareness Items
 Make sure you understand the pricing plans. Firebase typically has a free plan with
caps, but it may not be the default.
 The free plan may not have automated backups
 Firebase Realtime Database does not handle arrays
 You can still use arrays in your web app, though
Key Benefit
You can write applications more quickly
Getting Started
https://firebase.google.com/
https://github.com/energydev/expensify-app
Thank You
Catch up with me later
 Twitter @SQLEnergy
 Techlahoma Slack @EnergyDev

Intro to Firebase Realtime Database and Authentication

  • 1.
    Intro to Firebase RealtimeDatabase and Authentication BY KRISTIN FERRIER
  • 2.
    About Me –Kristin Ferrier  18+ Years in IT  Principal Consultant at Ferrier Solutions  Full stack web developer with specialty and passion for data  Twitter: @SQLEnergy  Techlahoma Slack: @EnergyDev  GitHub: @EnergyDev
  • 3.
    What we’ll cover Two ways Firebase can help with you build your applications faster  Firebase Realtime Database  Firebase Authentication
  • 4.
    Firebase Realtime Databaseand Authentication helping you build apps faster Firebase Realtime Database Authentication & Data Android is a trademark of Google LLC. iOS App Android ™ App React Web App
  • 5.
    Firebase Realtime Database Database as a Service (DBaaS) offered by Google  NoSQL, document database that stores data as JSON objects
  • 6.
  • 7.
    Data manipulation viaJavaScript apps import database from "../firebase/firebase"; return database.ref(`users/${uid}/expenses`).push(expense).then((ref) => { dispatch(addExpense({ id: ref.key, ...expense })); }) In JavaScript web applications, data is manipulated using JavaScript The below code is adding an expense to the Firebase realtime database and then adding it to the Redux store
  • 8.
    Validation and Security What if someone tries to bypass my front-end application, how are validation and security handled?  Database Security Rules within Firebase
  • 9.
    Lockdown users tojust their data Lock users down to just read/write their data This is done within Firebase, so security is there even if your front- end GUI is bypassed Please, see official Firebase documentation for the latest in security rule logic.
  • 10.
    Data Structure Validation Lockdown structure of data saved This is done within Firebase, so validation is there even if your front- end GUI is bypassed Please, see official Firebase documentation for the latest in security rule logic.
  • 11.
    Setup Security !!!!!!!!!!!!! Be sure to setup security  The DEFAULT is Read/Write for EVERYONE!  Even if they don’t have your database keys, your database can be read
  • 12.
    Firebase Authentication  Provideauthentication in your apps using any of the below platforms:  Email/Password  Phone  Google  Play Games  Facebook  Twitter  Github  Anonymous
  • 13.
    Add in LoginCapability with minimal JS Code
  • 14.
    Here’s the loginJS (Google auth) import { firebase, googleAuthProvider } from "../firebase/firebase"; export const startLogin = () => { return () => { return firebase.auth().signInWithPopup(googleAuthProvider); }; }; The Login with Google button calls the startLogin function above
  • 15.
    Firebase authentication  Canintegrate with Firebase Realtime Database  You can use it as a stand alone Firebase feature, as well
  • 16.
    Awareness Items  Makesure you understand the pricing plans. Firebase typically has a free plan with caps, but it may not be the default.  The free plan may not have automated backups  Firebase Realtime Database does not handle arrays  You can still use arrays in your web app, though
  • 17.
    Key Benefit You canwrite applications more quickly
  • 18.
  • 19.
    Thank You Catch upwith me later  Twitter @SQLEnergy  Techlahoma Slack @EnergyDev