RefirebaseRefirebase

deleteAccount

Permanently delete the current user's account.

Usage

Use the deleteAccount method to delete the authenticated user. Note that a recent sign-in might be required by Firebase.

⚠️
Re-authenticate the user if you encounter a credential error during deletion.
DeleteAccount.tsx
import { useRefirebase } from 'refirebase/react';

export function DeleteAccount() {
  const { auth } = useRefirebase();

  const handleDelete = async () => {
    const { error } = await auth.deleteAccount();
    if (error) console.error(error);
  };

  return <button onClick={handleDelete}>Delete My Account</button>;
}

Return value

Returns

Promise<{ error?: ReturnType<typeof toRefirebaseError> }>

An object containing an error if the deletion fails.