如何确定电子邮件是否已在 Firebase 简单登录中注册? [英] How to find out if an email is already registered with Firebase Simple Login?

查看:33
本文介绍了如何确定电子邮件是否已在 Firebase 简单登录中注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 html5 手机应用程序使用 firebase(使用 Angularfire).用户仅在开始屏幕中输入他们的电子邮件,然后,根据该电子邮件是否已注册,用户将被分别重定向到登录或注册页面.对于 step1,我们如何查询 firebase simple login 以确定电子邮件是否已注册?

I am using firebase (with Angularfire) for an html5 phone app. The user inputs only their email in the start screen, and then, depending on whether that email is already registered or not, the user is redirected to the login or registration page, respectively. For step1, how can we query the firebase simple login to determine if the email is registered or not?

推荐答案

更新 7/19/2018

不推荐使用前面提到的方法.现在使用 fetchSignInMethodsForEmail.

The previous mention method is deprecated. Now fetchSignInMethodsForEmail is used.

2016 年 6 月 26 日更新

自最初发布以来发生了很多变化,Firebase 身份验证不再称为 Firebase 简单登录.

A lot has changed since this was originally posted, Firebase Authentication is no longer called Firebase Simple Login.

此外,看起来有一种新方法可用 fetchProvidersForEmail 可以解决这个问题.

Additionally, it looks like a new method is available fetchProvidersForEmail which might provide a solution to this problem.

来自文档:

fetchProvidersForEmail(email) 返回包含非空字符串数组的 firebase.Promise

fetchProvidersForEmail(email) returns firebase.Promise containing non-null Array of string

获取可用于登录给定电子邮件地址的提供商 ID 列表.对标识符优先"有用登录流程.

Gets the list of provider IDs that can be used to sign in for the given email address. Useful for an "identifier-first" sign-in flow.

我尚未对此进行测试,但我想如果您调用该方法并接收一组提供程序,那么该电子邮件必须已在一个或多个身份验证提供程序中注册.

I have not tested this but I'd imagine if you call that method and receive an array of providers then the e-mail must already be registered with one or more authentication providers.

旧答案

我不相信您可以直接查询 Firebase 简单登录以获取该信息,而无需尝试实际登录用户或注册用户.

I don't believe you can query the Firebase Simple Login directly for that information without either trying to actually login the user or register them.

您需要做的是在注册过程中存储已注册电子邮件的列表,然后查询该列表.然后您可以查询该路径,如果返回数据,则它存在,否则不存在.

What you'd need to do is store a list of registered e-mails during your registration process and query that list instead. Then you can query that path and if it comes back with data, it exists, otherwise it doesn't.

这篇关于如何确定电子邮件是否已在 Firebase 简单登录中注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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