pyguy
pyguy

Reputation: 43

firebase best way to handle roles

I am newbie looking for the best solution to create roles for users in firebase (subscriber, etc). Do I create a user collection that is linked to the userid?

How do I incorporate it into a user signup:

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // ...
});

Upvotes: 1

Views: 2641

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599041

Since you mention creating a collection, I'll assume you're using Firestore. In that case have a look a the Firestore documentation on role based access control, which shows how to use a combination of Firebase Authentication and Firebase's server-side security rules to control access to the data in your database.

Upvotes: 2

Related Questions