Firebase Tutorial
Firebase Useful Resources
Selected Reading
- Firebase - Deploying
- Firebase - Security
- Firebase - Offline Capabilities
- Anonymous Authentication
- Firebase - Github Authentication
- Firebase - Twitter Authentication
- Firebase - Facebook Authentication
- Firebase - Google Authentication
- Firebase - Email Authentication
- Firebase - Best Practices
- Firebase - Filtering Data
- Firebase - Queries
- Firebase - Detaching Callbacks
- Firebase - Event Types
- Firebase - Read Data
- Firebase - Write Transactional Data
- Firebase - Write List Data
- Firebase - Write Data
- Firebase - Arrays
- Firebase - Data
- Firebase - Environment Setup
- Firebase - Overview
- Firebase - Home
Firebase Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Firebase - Security
Firebase - Security
Security in Firebase is handled by setting the JSON pke object inside the security rules. Security rules can be found when we cpck on Database inside the side menu and then RULES in tab bar.
In this chapter, we will go through a couple of simple examples to show you how to secure the Firebase data.
Read and Write
The following code snippet defined inside the Firebase security rules will allow writing access to /users/ $uid / for the authenticated user with the same uid, but everyone could read it.
Example
Let us consider the following example.
{ "rules": { "users": { "$uid": { ".write": "$uid === auth.uid", ".read": true } } } }
Vapdate
We can enforce data to string by using the following example.
Example
{ "rules": { "foo": { ".vapdate": "newData.isString()" } } }
This chapter only grabbed the surface of Firebase security rules. The important thing is to understand how these rules work, so you can combine it inside the app.
Advertisements