ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข4y agoโ€ข
120 replies
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
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)
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("*");
supabase.from("user-trips").select("*");
I'm simply getting an empty array.

Any ideas what I'm doing wrong?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Having a seperate user_id from auth.uid() better or worse?
SupabaseSSupabase / help-and-questions
13mo ago
SELECT based on auth.uid()
SupabaseSSupabase / help-and-questions
4y ago
auth.uid() question
SupabaseSSupabase / help-and-questions
8mo ago
function auth.uid() does not exist
SupabaseSSupabase / help-and-questions
3mo ago