1const listAllUsers = async (nextPageToken?: string) => {
2 const res = await firebase.auth().listUsers(1000, nextPageToken);
3 const users = res.users.filter(u => u.email?.includes('gmail.com'));
4 users.forEach(x => {
5 firebase
6 .auth()
7 .deleteUser(x.uid)
8 .then(() => {
9 console.log(`Successfully deleted user ${x.email}`);
10 })
11 .catch(error => {
12 console.log('Error deleting user:', error);
13 });
14 });
15 return users;
16 };
1admin
2 .auth()
3 .deleteUser(uid)
4 .then(() => {
5 console.log('Successfully deleted user');
6 })
7 .catch((error) => {
8 console.log('Error deleting user:', error);
9 });