1
votes

I am trying to setup a login process for firebase. I am going to be using client side user creation (because apparently firebase only allows client side user creation), and here's what my workflow looks like:

  1. User signs up through email and password
  2. Service creates an entry at /users/$uid, as well as a couple others (ie /table1/$uid, /table2/$uid)
  3. User can write to database at path /users/$uid, /table1/$uid, etc where $uid = the current logged in user (this is done via rules)

However, for number 2, I want to create the entry /users/$uid, but I dont want the user to have access to that at all. Is there any way to do this? One option I thought of was having a service account running with all r/w permissions on a node server to create those tables, but how would I call that server method if I'm doing all of the auth client side?

1

1 Answers

1
votes

After step #1,

  • Your client code can get a Firebase token for the current login user via firebase.user.getToken()
  • Your client app sends the token to your node server
  • The node server validates the token using Firebase server SDK
  • The server extracts user id from token.uid.

Now you can continue step #2 to create table for the user.