不使用电子邮件作为用户名的Firebase身份验证?

不使用电子邮件作为用户名的Firebase身份验证?,firebase,authentication,firebase-authentication,Firebase,Authentication,Firebase Authentication,在Firebase中是否可以使用字符串而不是电子邮件地址作为用户名 我试过了,但是createUser方法要求它是一个电子邮件地址。我是否可以绕过此限制?鉴于Firebase电子邮件+密码验证无法验证电子邮件地址是否确实存在,您可以在字符串末尾填充任何域。只要结果是语法有效的电子邮件地址,它就可以工作: var name = 'puf'; // TODO: read this from the form where the user enters their username var passw

在Firebase中是否可以使用字符串而不是电子邮件地址作为用户名


我试过了,但是
createUser
方法要求它是一个电子邮件地址。我是否可以绕过此限制?

鉴于Firebase电子邮件+密码验证无法验证电子邮件地址是否确实存在,您可以在字符串末尾填充任何域。只要结果是语法有效的电子邮件地址,它就可以工作:

var name = 'puf'; // TODO: read this from the form where the user enters their username
var password = 'geheim';
var email = name + '@whateverdomain.com';
ref.createUser({ email: email, password: password}...
请注意,用户将无法使用此方法接收密码恢复电子邮件


更新
函数示例
repo中有一个示例。

此帖子可能不是最新的:。“自定义”登录。你写这篇文章的时候,这种习俗不起作用吗?或者说它不存在吗?这个答案从现代标准来看确实很古老。但我刚刚添加了一个链接,指向如何实现这一点的最新示例。