Rules that run before user deletion

Hi,

I wonder if there is a way to run rules on user deletion? If not, is there another way to hook into user deletion? In our system we need to make a pre check before a user is deleted.

Thank you

1 Like

Hey there @flle!

Basically the core thing regarding rules that you need to take into account is that they are run upon successful login.

So there is no way to hook into account deletion?

Can you provide me with more context around what you want to do before deleting the user? What kind of pre-check is that?

Sure. Our users can own “Companies” in our software. The user should only be able to delete his account IF he’s not the only owner of the company. It would be good if our application could set a flag in the users app metadata that the user can be deleted. Users can delete them self if that flag is set to true (so before an account is deleted we would need to check if the user can be deleted). I personally would like to avoid having an access token on our backend that can delete users. So one solution would be what I described. Our application needs to allow it, and the user can then his account since the application gave approval. The users access token would need to have the delete account scope as well (don’t know if that’s the correct name of the scope - but I guess there is something like that).

1 Like

Any repsonse from auth0?
This feels like a valid question (I myself would like to trigger something on user deletion, e.g. blacklist on our e-mailing list that is managed elsewhere).

There’s nothing in Auth0 today (that I am aware of) that “triggers” on account deletion or an attempted account deletion. Perhaps Auth0 could create a new Hook that does this, though I can’t speak the technical possibility of that happening.

I would suggest submitting a feature request.

1 Like

The previous reply from Mark is correct; there’s nothing (hooks or rules) that would execute upon user deletion.

However, the user deletion should be surfaced in tenant logs so you can configure log streaming (Log Streams) to push tenant logs to your own system and from your own system configure alerts or actions to be taken for certain log events.

1 Like

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.