UID authentication to save in id Database

It’s possible go get the UID and to save in Database

first in my case I have a service with a method and to save the user in Authentication

  createUser(user: any, path: string) {
    return this.afu.auth.createUserWithEmailAndPassword(user.email, user.password)
                                .then((res) => {
                                  return this.service.save(user, path)

now, we call to save in Database

  save(user: any, path: string) {
    return new Promise((resolve, reject) => {
        return this.db.list(this.PATH + path)
                .then(() => resolve())

how to insert UID in ID in the database ?

This is my signup method where I call createUserWithEmailAndPassword and I save in database the user’s details.

 signupUser(email: string, password: string, name: string): Promise<any> {
    return firebase
      .createUserWithEmailAndPassword(email, password)
      .then( newUser => {
        .set({  email: email, 
                name: name, 

In my case I use the uuid like an identifier for the user, but you can do

 .set({  id: newUser.uid, 

Hope it helps!

1 Like

I did some tests and work with charm, perfect very good, now I can to create a user in authentication and object user too with the same UID good, thanks my friend
My code is:

  signupUser( user: any, path: string): Promise<any> {
    return firebase.auth().createUserWithEmailAndPassword(user.email, user.password)
    .then( newUser => {

Glad that helped :smiley: