Sometimes we need to wipe out our entire Firestore database. When that happens, it might also be useful to delete all existing users from the Firebase console.
As far as I know, we can't do that using the CLI. However, we can create a Cloud Function with an HTTPS trigger to delete all users:
export const deleteUsers = functions.https.onRequest(
async (req, res): Promise<any> => {
const allUsers = await auth.listUsers();
const allUsersUID = allUsers.users.map((user) => user.uid);
return auth.deleteUsers(allUsersUID).then(() => res.send("deleted"));
}
);
Top comments (0)