How to bulk delete Firebase anonymous users

后端 未结 7 2070
小鲜肉
小鲜肉 2020-12-16 03:27

Due to my probable misuse of anonymous authentication (see How to prevent Firebase anonymous user token from expiring) I have a lot of anonymous users in my app that I don\'

相关标签:
7条回答
  • 2020-12-16 04:31

    There is a firebase-functions-helper package, that can help to delete firebase users in bulk.

    // Get all users 
    firebaseHelper.firebase
        .getAllUsers(100)    
        .then(users => {        
            users.map(user => {
                firebaseHelper.firebase
                    .deleteUsers([user.uid]);          
            })   
        })
    

    The code above will get 100 users, and delete all of them. If you don't pass the number, the default value is 1000. You can read the instruction on Github repository.

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