Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create user in database after Firebase Auth (android)

I'm building an Android app and I want my users to be Auth then added to the database. For now I'm only doing the Auth with an email and password, then I click register and the user is created in the Auth section in the Firebase console.

But I also want my users to be added in the database. I want to add more fields (such as name, address etc) which will be stored in the users database in Firebase.

I just don't really see how to do that. Anyone could explain please?

Thanks!

like image 731
raphh Avatar asked Jul 01 '16 09:07

raphh


1 Answers

You should create a node where you save your users, like this:

users: {
  userID1: {
    name: 'Raph'
  },
  userID2: {
    name: 'Devid'
  }
}

Every logged user has a unique uid that you can use as key. You can find it in the authToken when you log your user in.

NOTE this is just a normal node in Firebase that you use to save user's data. It is an alternative solution to the Firebase generated users.

like image 120
Devid Farinelli Avatar answered Sep 22 '22 07:09

Devid Farinelli