Hey there, I’m super rookie and currently building a fun project just for the sake of learning.
I worked through some of the Academy already, but didn’t happen to find what I was searching for.
My setup is WeWeb + Supabase + Supabase Auth.
Let’s say I have a Supabase table with orders of all my users. each order has it’s own unique UUID but als the UUID of the user. When I’m in the Data Collections Tab in WeWeb I can set up the query and want to put a condition that only the data is fetched where user UUID matches the UUID of the currently logged in user.
I already played around with ChatGPT and Gemini but couldn’t solve the problem. I tried setting up a variable which gives the UUID of the current user. But it didn’t work.
Somebody experienced here who can help me with this approach or explain a more suitable approach? Highly appreciated!
Hello, there is two ways. You can either use a filter in the collection, or use RLS to limit this.
Hi Broberto,
thanks a lot for your reply! Could you maybe elaborate on that?
From what I learned in the academy, filtering in the collection would be done in the browser. So the data of all users would be then openly accessible which I don’t want.
RLS i in Supabase. But how do I tell Supabase what user is currently logged in into my Dashboard in WeWeb?
My approach was to tell weweb in the Supabase query that it should only pull the data from variable_xy. Variable_xy should then stand for the currently logged in user which WeWeb knows.
But maybe my thinking is wrong.
BR,
Jamin
Hey. This actually is not right, all the filtering happens on the backend with the Supabase collections/plugin actions.
The way Supabase works is, each request your users make, has a token attached, that basically identifies them. Of course they need to be logged in for this.
I suggest you check out how Supabase works under the hood, that might help to clarify many of the questions you might have. I also do some 1:1 consultations with non tech founders about this, you can check out the link in my bio if that’s someting that would interest you.