useDeleteAccount
Delete the account, with reauth and server cleanup.
const { deleteAccount, loading, error } = useDeleteAccount({
onBeforeDelete: (user) => deleteUserRecord(user.uid),
});
const result = await deleteAccount({ currentPassword });
if (result.success) router.push('/goodbye');Returns
deleteAccount({ currentPassword? }) resolves to { success: true } or a failure result. Also exposes loading and error.
Cleaning up first
onBeforeDelete runs while the user is still authenticated, which is the only moment your security rules will still let you delete their data. Throwing aborts the deletion, so a failed cleanup doesn't orphan records.
Reauthentication
Deletion requires a recent sign-in. Pass currentPassword for automatic reauthentication, or omit it for OAuth-only accounts and run your own step with useReauthenticate.
Options
Prop
Type