Angular is on Fire(base) - Shmuela Jacobs - Codemotion Amsterdam 2017
- 1. Angular is on Fire(base)!
Shmuela Jacobs
AMSTERDAM 16 - 17 MAY 2017
- 11. Firebase Authentication
Email + Password - with all the needed features
Federated identity providers - Google, Facebook...
Other identity providers - using Cloud Functions
Smart user management
Anonymous user
- 13. Cloud Functions
Firebase cloud messaging (FCM)
send emails
send SMS
modify realtime DB
execute intensive tasks
access storage
batch jobs
integrate with 3rd party services and APIs
NEW!
- 15. Project Setup
npm i angular-cli -g
ng new my-app --style=scss --prefix=sj -it --routing
cd my-app
npm i firebase angularfire2 -S
npm i firebase-tools -g
firebase login
firebase init
- 17. OpenFire Cookbook User Management
Authentication - password + Google
Routing
User Avatar
Read permission - all
Write permission - authenticated user
Edit permission - recipe owner
- 20. DB Rules
{
"rules": {
".read": true,
".write": false,
"recipes": {
"$recipeId": {
".write": "auth.uid != null && (!data.exists()
|| data.child('uid').val() === auth.uid)"
}
}
}
}
- 21. DB Rules
{
"rules": {
// By default, make all data private unless specified otherwise.
".read": false,
".write": false,
"room-metadata": {
".read": true,
"$roomId": {
// Append-only by anyone, and admins can add official rooms, and edit or remove rooms as
well.
".write": "(auth != null) && (!data.exists() || root.child('moderators').hasChild(auth.uid)
|| data.child('createdByUserId').val() === auth.uid)",
".validate": "newData.hasChildren(['name','type'])",
"id": {
".validate": "(newData.val() === $roomId)"
},
"createdByUserId": {
".validate": "(auth.uid === newData.val())"
},
"numUsers": {
".validate": "(newData.isNumber())"
},
"type": {
".validate": "('public' === newData.val()) || 'private' === newData.val() || ('official'
Erik Haddad - firechat
https://firechat.social
erikhaddad