RLS with Prisma

Hi, I'm using Supabase db and auth. In my BE I'm using Prisma that connects to the db using a user (prisma) with all privileges on public schema. I'd like to use Supabase RLS policies as an additional security layer for authorization. The problem is that I don't know how to properly query the database on behalf of a specific user. All queries from Prisma are done by the prisma user, so RLS cannot work.
1 Reply
garyaustin
garyaustin4w ago
Basically you would create a user role that obeys RLS and then pass in settings your can check in RLS. https://medium.com/@kavitanambissan/prisma-with-supabase-rls-policies-c72b68a62330 Technically you can set the settings to emulate the jwt settings PostgREST creates.

Did you find this page helpful?