How to delete firebase Authentication Users from Android App?

后端 未结 3 822
暖寄归人
暖寄归人 2021-01-27 14:00

Firebase dashboard view here

I need to remove A user from firebase authenticated Users list - using my mobile application. Authentication method is email and password au

相关标签:
3条回答
  • 2021-01-27 14:23

    To remove an other user you have to use Firebase Cloud Functions.

    Here an example to delete a user with the id.

    admin.auth().deleteUser(uid)
    .then(function() {
        console.log("Successfully deleted user");
    })
    .catch(function(error) {
        console.log("Error deleting user:", error);
    });
    

    (You must be logged as an admin)

    Then you can create an HTTP Trigger to call this function with parameters.

    0 讨论(0)
  • 2021-01-27 14:31

    If you want to allow application to delete user in the console, there is no pure client-side solution. As far as i've known, there are two option.

    1. User Firebase cloud function to delete user when specific event occur to Firebase database.
    2. Create backend with Admin SDK and build endpoints for user to call an manipulate user data.
    0 讨论(0)
  • 2021-01-27 14:36

    The Firebase Admin SDK allows deleting existing users by their uid: for reference: Check this link

    FirebaseAuth.getInstance().deleteUserAsync(uid).get();
    System.out.println("Successfully deleted user.");
    

    For app you can create API that will call this block on server. e.g. deleteUserCall() that takes email or userId as parameter and on server side against that userId you can delete that user

    0 讨论(0)
提交回复
热议问题