gpt4 book ai didi

javascript - 如何检查电子邮件地址是否已在 firebase auth 上注册,就像 firebaseui 那样?

转载 作者:行者123 更新时间:2023-12-02 21:55:49 26 4
gpt4 key购买 nike

firebaseui的登录顺序。

登录序列仅从电子邮件地址开始。

enter image description here

如果该地址已注册到 firebase,登录将继续。

enter image description here

如果未添加,将创建一个新帐户。

enter image description here

我的问题

如何像 firebaseui 那样检查已在 firebase auth 上注册或未注册的电子邮件地址?我正在寻找适当的 API 来检查电子邮件地址是否已添加。我已经搜索过 文件firebase. auth. Auth ,但我找不到它。我尝试了 firebase.auth().signInWithEmailAndPassword(this.email, "") 并期望得到错误 auth/user-not-found,但我已获得身份验证/错误密码

最佳答案

您可以使用文档中的以下方法:

fetchSignInMethodsForEmail

fetchSignInMethodsForEmail(email: string): Promise<Array<string>>

Gets the list of possible sign in methods for the given email address. This is useful to differentiate methods of sign-in for the same provider, eg. EmailAuthProvider which has 2 methods of sign-in, email/password and email/link.

Error Codes

auth/invalid-email Thrown if the email address is not valid.

Parameters

email: string

Returns Promise<Array<string>>

如果电子邮件未注册,这将返回错误

关于javascript - 如何检查电子邮件地址是否已在 firebase auth 上注册,就像 firebaseui 那样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60016350/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com