Basic user authentication with records in AngularFire

前端 未结 2 1155
暗喜
暗喜 2021-01-01 07:54

Having spent literally days trying the different, various recommended ways to do this, I\'ve landed on what I think is the most simple and promising. Also thanks to the kind

2条回答
  •  死守一世寂寞
    2021-01-01 08:19

    I don't think you want to store user-specific data under a non-user-specific index. Instead of push()ing to your firebase reference, store the user data behind a meaningful key.

    e.g.

    auth.createUser(email, password, function(error, user) {
      if (!error) {
        usersRef.child(user.id).set(stuff);
      }
    });
    

    Now you can actually fetch user data based on who is authenticated.

提交回复
热议问题