Firebase Auth uid 中的字符无效?

Invalid characters in Firebase Auth uid?

我想将多个 Firebase Auth uid 合并到一个字符串中。所以我需要知道哪些字符不可能出现在 uid 中。这样我就可以使用其中之一作为分隔符。

我查看了整个 Firebase 的文档,但似乎找不到答案

默认随机生成的 Firebase 身份验证 uid 是 28 个字符的字母数字字符串,没有特殊字符。


进一步的研究使我从 Firebase User ID Allowed Characters 得到了一个答案,它提出了一个模式:

^[0-9a-zA-Z]{27}[0-9]$

这与我在几个 Firebase 项目中得到的 uid 匹配,所以看起来是正确的。

From my experience, the latest version of Firebase follows the ^[0-9a-zA-Z]{27}[0-9]$ pattern.

I don't know why there's always a digit at the end, but that seems to be consistent.

根据文档,允许使用 1 到 128 个字符之间的任何字符串。

来源:https://firebase.google.com/docs/auth/admin/manage-users(参见:Table 1.创建用户操作支持的属性)

注意:虽然uid可以是任何字符串,但实时数据库不能使用任何字符串。因此,如果您想使用 uid 创建文档,则必须遵守这些规则 Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"