Reauthenticate user x from an “admin user” to delete user x

前端 未结 2 508
深忆病人
深忆病人 2021-01-25 17:38

In others Firebase version with removeUser we can delete an user only using email and password. With the new Firebase version it seems you can only delete and user if you have c

2条回答
  •  失恋的感觉
    2021-01-25 18:15

    Finally the code should be something like this

     mAuth.signOut();
    mAuth.signInWithEmailAndPassword(email,password)
            .addOnCompleteListener(UserList.this, new OnCompleteListener() {
                @Override
                public void onComplete(@NonNull Task task) {
                    if (!task.isSuccessful()) {
                        mAuth= FirebaseAuth.getInstance(myFirebaseRef.getDatabase().getApp());
                        try{
    
                            mAuth.signInWithEmailAndPassword(getsPreferences().getString("mailUser",""), getsPreferences().getString("pwd",""))
                                    .addOnCompleteListener(UserList.this, new OnCompleteListener() {
                                        @Override
                                        public void onComplete(@NonNull Task task) {
    
                                        }});
                        }catch(Exception e){
    
                        }
                    }
                }});
    

提交回复
热议问题