Issues accessing gated page Using supabase user roles in published version

I have a page “dashboard” that is gated to only be accessible to users & admins

i have a user whose role is admin

when i log in as that user and try to access “dashboard” i get an error that the page doesnt exist.

@Alexis am i doing something wrong here?

I can visit any other page as the same user that is not gated

[update]
i have updated my gating to this and still recieve this error after logging in and navigating to the page

it seems that any time i have put a restriction of needing to be authenticated, the systems seems to think i am not authenticated though i am. something is wrong here. i have no issues vising any page when logged in as a user in the editor

I heard back from support. the issue was related to my role id’s being int’s vs uuid’s. I’ve since updated but am now. having further weird issues related to roles and gating pages. same issue, slightly different context.

i updated the roles table and now my roles show as an empty array in the user object

my roles. table

my userRoles table

my user object when logging in as a user with id 99d3c99e-1d9b-4921-8a66-1c1ac18902c6 (this user has 2 entries in the userRoles table)
Screen Shot 2023-07-20 at 10.01.45 AM

the same user when viewed from the weweb user management table

update:

After removing RLS for my roles table, i am now able to see the role on the user object. After watching the video on userRoles, i also think the issue was how User Groups are setup. When you say User group X must be of User Type A, B, C. those users will need all 3 types associated with them, not 1 or the other.

So, problem solved now. for now

Yeah, you’re not the first to give us this feedback about User groups, this is not clear for everyone. The condition is a AND, not an OR.

To match an User Group you have to match every role inside. To access a page you have to match only one of the User Group.

So for the AND logic you do it at the UserGroup level
For the OR logic you do it at the page access level

1 Like