re: How to add user authentication to your MVP using FaunaDB VIEW POST

re: I just found your article, but i've implemented something related, although i'm still trying to understand and learn how the roles work. My impleme...

Have you set the Membership for the role?
This is from the article:

Now let’s look at the membership. By adding the User collection, we state that all users who are members for the User collection will be granted the privileges we’ve defined for this role, once they obtain a valid token using the Login function.

And this is how I check that the all actions defined in the DEVELOPER role are actually applied to all users with DEVELOPER role.

  membership: [
      resource: Collection("User"),
      predicate: Query(
          Equals(Select(["data", "role"], Get(Var("userRef"))), "DEVELOPER")

You should also make sure, you allow your role to read the index that fetches a user.

Let me know if you need help.

Code of Conduct Report abuse