了解Firebase的createUser函数(特别是android库) [英] Understanding createUser function of firebase(specifically android library)

查看:116
本文介绍了了解Firebase的createUser函数(特别是android库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有以下代码是从firebase文档中获得的(我已经在我的应用程序中实现了,并且可以正常工作):

So I have the following code that I got from the firebase documentation (which I implemented in my app already and it's working fine):

    Firebase ref = new Firebase("https://myapp.firebaseio.com");
    ref.createUser("bobtony@firebase.com", "correcthorsebatterystaple", new Firebase.ValueResultHandler<Map<String, Object>>() {
       @Override
       public void onSuccess(Map<String, Object> result) {
          System.out.println("Successfully created user account with uid: " + result.get("uid"));
       }
       @Override
       public void onError(FirebaseError firebaseError) {
        // there was an error
       }
    });

创建用户后,它将在控制台上打印其uid.但是,当我输入myapp.firebaseio.com时,那里什么都没有..所以我有一些问题:

after I create a user it prints on the console its uid. However, when I enter in my myapp.firebaseio.com there is nothing there.. So I have some questions:

  1. firebase在哪里存储此新创建的用户?
  2. 如何添加一些自定义字段? (此功能仅使用电子邮件和密码),即用户名

所以,我想做的是在onSuccess()里面,我使用了ref.push()到myapp.firebaseio.com的一些值,但是然后..我如何检查由createUser()创建的用户uid和我推过的那个一样吗? (ID是不同的!)

So, What I have tried to do was inside the onSuccess() I used ref.push() some values to myapp.firebaseio.com but then .. how can I check if the users uid created by the createUser() is the same as the one who I pushed? (the id's are differente!)

如果没有要求,我希望我的文字清楚,我可以尝试再次解释!

I hope my text it's clear, if isn't asked and I can try to explain again!

谢谢一堆!

推荐答案

用户信息存储在Firebase数据库中.对于匿名用户和OAuth用户,没有信息存储在任何地方.电子邮件和密码用户的信息保存在您无权访问的单独数据库中.电子邮件和密码用户在登录名"和收件人"中可见.当然,您的信息中心中的身份验证"标签并不在您的数据库中.

User information is not stored inside your Firebase database. For anonymous and OAuth users, no information is stored anywhere. The information for email+password users is kept in a separate database that you don't have access to. The email+password users are visible in the Login & Auth tab of your dashboard of course, just not in your database.

如果要将用户信息存储在自己的Firebase数据库中,则在创建或验证用户身份时必须将其自己存储在其中. 有关在Firebase文档中存储用户数据的部分显示该怎么做.

If you want to store user information in your own Firebase database, you have to store it there yourself when you create or authenticate the user. There is a section on storing user data in the Firebase documentation that shows how to do this.

必须自己存储信息的一个优点是,您可以准确确定存储的内容和未存储的内容.

One advantage of having to store the information yourself, is that you get to determine exactly what is and what isn't stored.

这篇关于了解Firebase的createUser函数(特别是android库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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