Role-Based Authorization with Firestore

Fireship · 118K views · 2017 · 10:33

Open on YouTube

Web developmentSecurity & hackingDatabases & storagetutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when someone asks how to model user roles or restrict features by user type in a Firebase or Firestore app.

Recommended by 2 people across 2 different months, 2018 to 2022.

What it is

A roughly ten-minute Fireship tutorial on building role-based access control with Firestore and Angular 5. It shows how to assign users roles and abilities, enforce them with Firestore security rules, and use Angular route guards.

What people said

Recommends Isuru Fonseka · 2018-10 · Stack Overflow · on “How to pass extra auth parameters for firestore rules authentication (React-Native)?”

It's a little hard to follow the question but I would advise watching this video, even though its for angular, it's still firebase/firestore and it tackles how to conceptually introduce role-based auth into a firestore application. [this video]

Recommends Frank van Puffelen · 2022-01 · Stack Overflow · on “Should I query my Firebase database directly, or use Cloud Functions”

That is quite normal, but it's something we can't take away for you. I recommend reading the documentation ( 1 [LINK] , 2 [LINK] ) watching these videos ( 1 [LINK] , 2 [LINK] , 3 [this video] , 4 [LINK] ), and trying to build your own rules and then to break them.

Cites Josh Pittman · 2019-12 · Stack Overflow · on “Letting different types of users use different aspects of my firebase app”

The way to do this is to implement role-based user authorization and security rules by adding custom claims to the Firebase Auth ID token. Here are some resources to get you started: [LINK] [this video]