SupabaseS
Supabaseโ€ข4y ago
dan_v

auth.uid() = user_id not working on server

I've been following this RLS video tutorial in the docs, but can't for the life of me get it to work for the currently authenticated user.

I have a column in my table called
user_id
where I'm saving the uid, and I'm trying to create the following policy.

CREATE POLICY "Enable select for users based on user_id" ON "public"."user-trips"
AS PERMISSIVE FOR SELECT
TO public
USING (auth.uid() = user_id)


However when calling supabase.from("user-trips").select("*"); I'm simply getting an empty array.

Any ideas what I'm doing wrong?
Was this page helpful?