Skip to content

Instantly share code, notes, and snippets.

@billydh
Created March 10, 2020 07:23
Show Gist options
  • Select an option

  • Save billydh/2f5c7ccae465f51c72c8652e06948b58 to your computer and use it in GitHub Desktop.

Select an option

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
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