Home > Software design >  Delete auth user in firebase react native
Delete auth user in firebase react native

Time:12-20

I am trying to delete auth user from firebase with email or uid. I searched on google but I did not find any solution.

CodePudding user response:

There is a code section:

getAuth()
  .deleteUser(uid)
  .then(() => {
    console.log('Successfully deleted user');
  })
  .catch((error) => {
    console.log('Error deleting user:', error);
  });

Additionally reference link: https://firebase.google.com/docs/auth/admin/manage-users#delete_a_user

CodePudding user response:

I found this method, but this deletes current user, I want to delete the specific user.

import { getAuth, deleteUser } from "firebase/auth";

const auth = getAuth();
const user = auth.currentUser;

deleteUser(user).then(() => {
// User deleted.
}).catch((error) => {
// An error ocurred
// ...
});
  • Related