https://supabase.com/ logo
Is there a way to delete from the auth.users table...
# help
m
Is there a way to delete from the auth.users table? We want to add the ability for a user to delete their account so I tried writing a PostgreSQL function which works from the query console, but calling it from the client side using rpc gives a permission error. We also have a users table in the public schema separate from auth.users, but if we only delete from the public users table you can still sign in so we don't want that behaviour.
n
Hello @MementoMori! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
v
postgres functions are by default
security invoker
, which means they have the access the function invoker has. But calls over postgrest only have access to the public schema. You need to make the function
security definer
. But be caution to verify the request, because it could allow everyone to delete any account. https://supabase.com/docs/guides/database/functions#security-definer-vs-invoker
m
Thanks!
n
Thread was archived by @MementoMori. Anyone can send a message to unarchive it.