L11 Firebase
L11 Firebase
1
What is firebase?
2
3
What is Firebase?
• Firebase is a platform for web and mobile app development, which
includes simple and powerful APIs without the need for a backend
server (serverless).
• Firebase support 2 platform Android and IOS.
• Firebase is Google's cloud-based database service.
• Firebase also provides a complete list of products to support
Developers in their development app. Two database options are
Firestore and Firebase's Realtime Database. It also enables serverless
application development through the integration of Cloud Functions.
4
Lab: Authentication with Firebase
• Create project with 3 screens: Register, Login, Home
• Register, Login: Email, Password
• If authenticate = true navigate to HomeScreen
• If authenticate = false navigate to LoginScreen. After register
success, navigate to LoginScreen. If not yet register, navigate Register
• If process LoginScreen == true navidate to HomeScreen
https://console.firebase.google.com
5
Getting Start with Firebase
1. Create Firebase Project in the Firebase console.
https://console.firebase.google.com (need Google account)
2. Retrieve apiKey, authDomain, databaseURL, and storageBucket
from Firebase console.
3. Create a new react-native project
4. Install Firebase from npm
5. Add it into react-native project
6
Create Firebase Project
• Login Google account
• Go to https://console.firebase.google.com
• Add project
7
• Fill project name
8
• Should turn OFF Google Analytics
9
• Select location country & Accept terms
10
11
Create Web app
12
13
• Copy and paste to:
firebase.js
14
15
Firebase authentication
• https://firebase.google.com/docs/auth – ver 9
• Password authentication
• Create new account (createUserWithEmailAndPassword)
16
Firebase authentication - Password authentication
• Sign in a user with an email address and password
• signInWithEmailAndPassword
17
Enable firestore
18
19
• Select a location
20
Named a collection
21
• Set RULE permit change data
22
Cloud firestore
• https://firebase.google.com/docs/firestore
23
Cloud firestore
• https://firebase.google.com/docs/firestore
24
Cloud firestore
• https://firebase.google.com/docs/firestore
25
References
• React Native Firebase
• https://rnfirebase.io
• Firebase:
• https://firebase.google.com/docs
26