Hi, I have an RLS policy set, and I want to use th...
# help
a
Hi, I have an RLS policy set, and I want to use the JS client to query data from the table. I have my service role key. Where exactly do I pass it so that it can bypass the RLS? Here's my JS code:
Copy code
js
await supabase.from("integrations").select();
And here's the policy:
Copy code
sql
CREATE POLICY "Don't allow anyone to read" ON public.integrations USING (false);
Thanks for your time, and please ping me 🙂
s
You shouldn't use the service role key on the client as its exposed to everyone and can be used to do more harm than good.
a
I am using the Supabase JS sdk on the server side in NextJS
Is there a way to pass the service key with the SDK or do I have to use the API?
s
You need to instantiate the library with the service key in the NextJS server code then