0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Firebase Authenticationのユーザーをブラウザから一括削除する

Posted at

自分用の備忘録。
ブラウザからfirebaseのユーザーを一括削除するときのコード。ブラウザのコンソールにて実行する。
warningが出るため allow pastingを打つこと。

let count = 0;
const MAX = 200; // 安全のため上限設定

const interval = setInterval(() => {
  const deleteButtons = document.querySelectorAll('.edit-account-button');

  if (deleteButtons.length === 0 || count >= MAX) {
    clearInterval(interval);
    console.log("処理終了");
    return;
  }

  // 最初のユーザーを選択
  deleteButtons[0].click();
  count++;

  // モーダルが開くまで待つ
  setTimeout(() => {
    const delBtn = [...document.querySelectorAll("button")].find(b => 
      b.textContent.includes("アカウントを削除")
    );
    if (delBtn) delBtn.click();

    // 確認ダイアログのOKボタンを押す
    setTimeout(() => {
      const confirmBtn = document.querySelector('.confirm-button');
      if (confirmBtn) confirmBtn.click();
      else console.warn("confirm-button が見つかりませんでした");
    }, 500);

  }, 700);

}, 2000);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?