api key

Hey guys please how do i secure my supabase api key in my sveltekit website when i have to call it every time to insert data ?
5 Replies
garyaustin
garyaustin2y ago
The anon apikey is considered public info. You can't hide if using a browser.
adam boukhris
adam boukhrisOP2y ago
so that means anyone can acces my database ?
garyaustin
garyaustin2y ago
You have to use RLS to protect it. All REST APIs are the same if you want to access from browser.
adam boukhris
adam boukhrisOP2y ago
What if i use express ? I think it's much secure right ?
garyaustin
garyaustin2y ago
If you run the code from a server or some native apps then the user can’t see it. But if the browser ever gets used even for one call or your anon key is in a public repository then you still need RLS.

Did you find this page helpful?