Reputation: 381
I am trying to delete auth user from firebase with email or uid. I searched on google but I did not find any solution.
Upvotes: 4
Views: 6334
Reputation: 433
For React Native
import auth from "@react-native-firebase/auth";
let user = auth().currentUser;
user
.delete()
.then(() => console.log("User deleted"))
.catch((error) => console.log(error));
Upvotes: 6
Reputation: 381
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
// ...
});
Upvotes: 2
Reputation: 603
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
Upvotes: 1