Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Concurrent calls to auth.createUser() may create multiple user accounts with the same email address

未关闭
#2,949 0 条评论 7 个 reaction 已指派 2 人 在 GitHub 查看

@Xiaoshouzi-gh 已经在做这个了。

开始于 2025年7月15日。

评估

这个 Issue 还没有评估数据。

描述

api: auth
[REQUIRED] Step 2: Describe your environment
  • Operating System version: macOS 14.6.1 (23G93)
  • Firebase SDK version: firebase-admin@13.2.0
  • Firebase Product: auth
  • Node.js version: 20.18
  • NPM version: 10.8.2
[REQUIRED] Step 3: Describe the problem

Firebase does not guarantee user email uniqueness in users in case duplicate & concurrent calls are made to auth.createUser(), despite the "User account linking" setting in the Console being set to "Link accounts that use the same email". The API is not idempotent.

This issue breaks the promise found in the following support documentation:

Users can never create multiple accounts with the same email address and sign-in method.

If calls to auth.createUser with the same email are separated enough in time (some tens of milliseconds?), the last call will raise a auth/email-already-exists error, which is the expected behavior.

Steps to reproduce:
  1. Run this Firebase Admin JS script against a production Firebase environment, using node v20
// `auth` is a Firebase Admin auth instance
import { auth } from "../src/admin.js";

const c = () =>
    auth.createUser({
        email: "thor+duplicatetest@slowby.travel",
        displayName: "Test",
    });

await Promise.all([c(), c()]);
  1. Observe that two users were created with the same details, with different UIDs

    Screenshot of the Firebase Console Auth dashboard
Workaround

Avoid concurrent calls to auth.createUser() with the same email address.

We were likely getting this issue because our front-end registration form would be submitted two times if double-clicked, which in turn lead to two concurrent auth.createUser calls in the back-end. Now we've debounced this call, which should avoid the issue in most circumstances.

More context
  • We are not using "Firebase Auth with Identity Platform"
  • I believe this is exactly the same issue as the following issue reported for the Python Admin SDK https://github.com/firebase/firebase-admin-python/issues/809
  • We saw an increase in the frequency of this issue since we started using the Firebase Admin SDK for Firebase Auth account creation (5 cases over 2 months). In the years before, when we were still using front-end Firebase JS clients for Firebase Auth account creation, we only had 1 similar case. I assume the frontend client implements some kind of debouncing internally already?
主要语言
TypeScript
星标
1.7k
派生
419
平均合并
4 天 20 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-admin-node 的其他 Issue

查看 firebase/firebase-admin-node 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。