Firebase身份验证-使用电子邮件和密码-检查用户是否已注册 [英] Firebase Auth - with Email and Password - Check user already registered

查看:164
本文介绍了Firebase身份验证-使用电子邮件和密码-检查用户是否已注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查用户何时尝试使用Firebase用户身份验证方法中的createUserWithEmailAndPassword()进行注册,该用户已在我的应用程序中注册.

I want to check when a user attempts to signup with createUserWithEmailAndPassword() in Firebase user Authentication method, this user is already registered with my app.

推荐答案

要检测是否已经存在具有该电子邮件地址的用户,您可以检测到createUserWithEmailAndPassword ()的调用何时失败,并显示auth/email-already-in-use.我看到@Srinivasan刚刚为此发布了答案.

To detect whether a user with that email address already exists, you can detect when the call to createUserWithEmailAndPassword () fails with auth/email-already-in-use. I see that @Srinivasan just posted an answer for this.

或者,您可以通过调用

Alternatively, you can detect that an email address is already used by calling fetchSignInMethodsForEmail(). The usual flow for this is that you first ask the user to enter their email address, then call fetchSignInMethodsForEmail, and then move them to a screen that either asks for the rest of their registration details (if they're new), or show them the provider(s) with which they're signed up already.

这篇关于Firebase身份验证-使用电子邮件和密码-检查用户是否已注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆