supabase-py icon indicating copy to clipboard operation
supabase-py copied to clipboard

Row Level Security and Python

Open titogarrido opened this issue 4 years ago • 1 comments

Hi Folks!

I am calling a python API from Vue app where an user is logged in using supabase. This Python API was created using FastAPI and I have shared the same JWT secret and algorithm so I can ensure who is calling the API. The problem is when I try to execute an insert using supabase client + anon key I am receiving a RLS error, seems that it can't identify who is calling the insert from the python client.

My RLS is:

Enable insert for authenticated users only
(role() = 'authenticated'::text)

Is it possible somehow to pass which user is calling the python API using supabase-py? I do have the access_token sent by the javascript client but I have no idea how to share it and use on supabase.table("projects").insert

titogarrido avatar Oct 10 '21 15:10 titogarrido

related: https://github.com/supabase-community/supabase-py/issues/70

karolzlot avatar Oct 17 '21 02:10 karolzlot

We've added full support for RLS in the Python library as of version 1.1.0.

silentworks avatar Oct 21 '23 22:10 silentworks

We've added full support for RLS in the Python library as of version 1.1.0.

Can you show us how to use it? I've been looking for 1 hour, but don't know how to get RLS working with the Supabase Python Client...

shredEngineer avatar Feb 23 '24 21:02 shredEngineer