Saving player's data using firebase

Hi, I want to know if it is possible to create a code like this that works with firebase.
This code saves the creation and data of the object so when the player loads back, things are still present.

My current issue is trying to do something similar when it comes to using firebase.

  1. Having the user logged in : It is easy do to, but not sure how to make the fetched data from firebase does in fact belong to the player
  2. Is it possible to upload the user’s storage data to there directly?
  3. If no. 2 isn’t possible, what is the workaround?

(Current code in action using local storage)