How can I set up an admin dashboard with supabase-...
# help
v
How can I set up an admin dashboard with supabase-js querying to bypass RLS stuff?
k
You'll need to use the key from project Settings -> API -> service_role secret
But never use it in browser, this key should only be used with a trusted server-side app.
v
Yes, but how can I fetch data with the library and bypass RLS without exposing that key?
k
You'd need a server-side component that prepares dashboard data. I don't know what's your architecture, the options I see are: 1. allow admins to see all data they need for dashboards, 2. prepare dedicated "security definer" functions that expose dashboard data (and check that the current user is an admin)
v
Aight, thanks!