DEV Community

Discussion on: How to add user authentication to your MVP using FaunaDB

Collapse
 
sandorturanszky profile image
Sandor | tutorialhell.dev

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(
        Lambda("userRef", 
          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.