Created
March 10, 2020 07:23
-
-
Save billydh/2f5c7ccae465f51c72c8652e06948b58 to your computer and use it in GitHub Desktop.
A Python script to delete a user by user id using Firebase Admin SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| from firebase_admin import auth | |
| from initialise_firebase_admin import app | |
| def get_user_id_arg(): | |
| parser = argparse.ArgumentParser(description="Delete user in Firebase") | |
| parser.add_argument("--user-id", required=True, help="The user id of the user to be deleted.") | |
| return parser.parse_args() | |
| def delete_user(user_id: str): | |
| return auth.delete_user(user_id) | |
| if __name__ == "__main__": | |
| args = get_user_id_arg() | |
| user = delete_user(args.user_id) | |
| print(f"Firebase has deleted user with user id - {args.user_id}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment