authClient.admin.removeUser doesn't trigger beforeDelete
I'm using the admin plugin. It has authClient.admin.removeUser functionality. the problem is that I set up user beforeDelete to delete all of the images from my s3 bucket before removing the user and it doesn't work. It works if and only if the user deletes himself manually.
user deletion from the admin side:
better-auth instance:
3 Replies
We have a method to allow the user to delete their own account. (assuming you set
user.deleteUser.enabled
to true)
user.deleteUser
is that configuration. It's not related to the general before or after events of a user being delete.Alright, what's "the general before or after events of a user being delete"
Could you please tell me where is it in the docs?
I set user.deleteUser.enabled to true
You have to use hooks and run checks to find that case if you want events for it.
Otherwise, which is more what we recommend for now, is to just write code to call a function to clean up the user for every user delete case