From the course: Firebase Essential Training
Control access with Cloud Functions - Google Cloud Tutorial
From the course: Firebase Essential Training
Control access with Cloud Functions
- [Instructor] Okay, previously we saw how to use Firebase cloud functions to implement an email verification flow. And even though Firebase Auth has its own built-in email verification function, this was a good example for us to walk through because it gave us some good hands-on experience with a lot of the things that it's possible to do from inside cloud functions. We saw, for example, that we could have functions that were activated by HTTP requests and by changes to the Firestore. And in addition to the different ways that cloud functions can be triggered, we also saw that our functions could use the admin SDK to interact with other Firebase services, such as making changes to Firebase Auth and reading from and writing to our project's Firestore. And this can be really helpful in a lot of cases. The main use case that we'll be looking at in this section is using cloud functions as a sort of security measure to make sure that users can only interact with our Firestore in well-defined ways. And here's what I mean by that. When we first learned about Firestore, we saw that we could control user access using security rules. Remember these sort of JSON-looking things? Well, we use security rules to make sure that users could only modify their own user data, as well as make sure that only users with confirmed emails could read and write data. Now, security rules are great for broad-brush stuff like that, but there are a lot of situations where we need much more fine grain control over what users are allowed and not allowed to do. And it's in these situations that it becomes just a lot easier to use cloud functions instead of security rules. For example, we want our users to be able to make reservations, but we only want them to be able to make reservations for time slots that a given restaurant has open. Over the next few videos, we'll be looking at these sorts of situations and how to implement them using cloud functions.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Control access with Cloud Functions1m 42s
-
(Locked)
Set up to run functions locally7m
-
(Locked)
Run Cloud Functions2m 55s
-
(Locked)
The Make a Reservation function, part 18m 44s
-
(Locked)
The Make a Reservation function, part 25m 12s
-
(Locked)
The Submit Review function11m 37s
-
(Locked)
The Cancel Reservation function7m 17s
-
(Locked)
The Get Recommendations function6m 55s
-
(Locked)
The Search Restaurants function6m 20s
-
-
-
-
-