Closed oskarrough closed 3 years ago
Seems it's recommended to use a postgresql procedure for this. This way you avoid passing in an id
and avoid row security issues (?).
CREATE or replace function delete_user()
returns void
LANGUAGE SQL SECURITY DEFINER
AS $$
delete from auth.users where id = auth.uid();
$$;
Procedures can be called with supabase like this
const { data, error } = await supabase.rpc('delete_user')
... in one go I guess.
https://github.com/supabase/supabase/discussions/1066