How do i set role with Supabase?

96 Views Asked by At

I have been trying to set roles in my supabase database but it doesn't work and i can't find any helpful docs.

So i made a policy that restrain user from seeing other users data with : (((auth.jwt() ->> 'sub'::text) = (id)::text) And then i added this : (((auth.jwt() ->> 'sub'::text) = (id)::text) OR (auth.role() = 'admin'::text)) That suposedly would have checked the auth.role() and if the user is admin, then he can can bypass this policy. But it doesn't work. The role of my user is indeed "admin".

0

There are 0 best solutions below