Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Facebook或谷歌认证Firebase用户_Firebase_Firebase Authentication - Fatal编程技术网

通过Facebook或谷歌认证Firebase用户

通过Facebook或谷歌认证Firebase用户,firebase,firebase-authentication,Firebase,Firebase Authentication,我正在尝试使用Firebase Admin SDK删除经过身份验证的用户。可以使用删除所有用户。但是,我只想删除那些通过特定身份验证服务提供商验证的用户,即删除通过Google/Facebook验证的用户,并保留使用电子邮件登录的用户 你可以试试这样的 function listAllUsers(nextPageToken) { // List batch of users, 1000 at a time. admin.auth().listUsers(1000, nextPageTok

我正在尝试使用Firebase Admin SDK删除经过身份验证的用户。可以使用删除所有用户。但是,我只想删除那些通过特定身份验证服务提供商验证的用户,即删除通过Google/Facebook验证的用户,并保留使用电子邮件登录的用户

你可以试试这样的

function listAllUsers(nextPageToken) {
  // List batch of users, 1000 at a time.
  admin.auth().listUsers(1000, nextPageToken)
    .then(function(listUsersResult) {
      listUsersResult.users.forEach(function(userRecord) {

        //Check if the user signed in with Google/Facebook

        if (userRecord.providerId == "Google" || userRecord.providerId == "Facebook") {
         //Delete user
          admin.auth().deleteUser(userRecord.uid)
        }

      });
      if (listUsersResult.pageToken) {
        // List next batch of users.
        listAllUsers(listUsersResult.pageToken);
      }
    })
    .catch(function(error) {
      console.log('Error listing users:', error);
    });
}
// Start listing users from the beginning, 1000 at a time.
listAllUsers();

这是未经测试的,所以我不确定这个确切的代码是否能工作,但你明白了。

你可以试试这样的东西

function listAllUsers(nextPageToken) {
  // List batch of users, 1000 at a time.
  admin.auth().listUsers(1000, nextPageToken)
    .then(function(listUsersResult) {
      listUsersResult.users.forEach(function(userRecord) {

        //Check if the user signed in with Google/Facebook

        if (userRecord.providerId == "Google" || userRecord.providerId == "Facebook") {
         //Delete user
          admin.auth().deleteUser(userRecord.uid)
        }

      });
      if (listUsersResult.pageToken) {
        // List next batch of users.
        listAllUsers(listUsersResult.pageToken);
      }
    })
    .catch(function(error) {
      console.log('Error listing users:', error);
    });
}
// Start listing users from the beginning, 1000 at a time.
listAllUsers();
这是未经测试的,所以我不确定这个确切的代码是否会工作,但你明白了